Commit c130c09d authored by Adam Langley's avatar Adam Langley Committed by Chromium LUCI CQ

webauthn: duplicate the spinner screen from Play Services.

In order to have a smooth A/B test, this change duplicates the existing
spinner screen used by Play Services for caBLEv1 so that it appears for
server-linked caBLEv2.

BUG=1002262

Change-Id: I36b4c9fc30693cb94bfd4b82a7dc78921384e59e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580839Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Commit-Queue: Adam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835764}
parent f153e47e
......@@ -45,7 +45,27 @@ generate_jni("jni_headers") {
android_resources("java_resources") {
sources = [
"java/res/anim/circle_loader_animation_interpolator_0.xml",
"java/res/anim/circle_loader_animation_interpolator_1.xml",
"java/res/anim/circle_loader_animation_interpolator_2.xml",
"java/res/anim/circle_loader_animation_interpolator_3.xml",
"java/res/anim/circle_loader_animation_interpolator_4.xml",
"java/res/anim/circle_loader_animation_interpolator_5.xml",
"java/res/anim/circle_loader_animation_interpolator_6.xml",
"java/res/anim/circle_loader_animation_interpolator_7.xml",
"java/res/anim/circle_loader_animation_interpolator_8.xml",
"java/res/anim/circle_loader_circleblue_animation.xml",
"java/res/anim/circle_loader_circlegreen_animation.xml",
"java/res/anim/circle_loader_circlered_animation.xml",
"java/res/anim/circle_loader_circleyellow_animation.xml",
"java/res/anim/circle_loader_ellipse_path_2_animation.xml",
"java/res/anim/circle_loader_ellipse_path_3_animation.xml",
"java/res/anim/circle_loader_ellipse_path_4_animation.xml",
"java/res/anim/circle_loader_ellipse_path_5_animation.xml",
"java/res/drawable/circle_loader.xml",
"java/res/drawable/circle_loader_animation.xml",
"java/res/drawable/header.xml",
"java/res/drawable/ic_lock_googblue_48dp.xml",
"java/res/layout/cablev2_fcm.xml",
"java/res/layout/cablev2_qr_dialog.xml",
"java/res/layout/cablev2_qr_scan.xml",
......
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333329632,0.0 0.666666665894,0.322097851136 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.16666666667,0.0 0.83333333333,1.0 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333334019,0.343686794807 0.66666667038,1.0 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333330786,0.0 0.666666664831,-0.0357237301378 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333335183,0.262122165085 0.666666669277,1.0 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333329651,0.0 0.666666665819,0.296503258699 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333335211,0.272893937785 0.666666669347,1.0 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.333333329632,0.0 0.666666665894,0.0961304681815 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:pathData="M 0.0,0.0 c 0.33333333,0.0 0.66666667,1.0 1.0,1.0"
tools:targetApi="21"/>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="2000"
android:propertyName="rotation"
android:valueFrom="0.0"
android:valueTo="396.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="2000"
android:propertyName="rotation"
android:valueFrom="-116.0"
android:valueTo="316.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="2000"
android:propertyName="rotation"
android:valueFrom="-18.0"
android:valueTo="378.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="2000"
android:propertyName="rotation"
android:valueFrom="-84.0"
android:valueTo="348.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="1000"
android:propertyName="trimPathEnd"
android:valueFrom="0.2"
android:valueTo="0.5"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_7" />
<objectAnimator
android:duration="483"
android:propertyName="trimPathEnd"
android:valueFrom="0.5"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_4" />
<objectAnimator
android:duration="516"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="516"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
<objectAnimator
android:duration="966"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.33644"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_5" />
<objectAnimator
android:duration="516"
android:propertyName="trimPathStart"
android:valueFrom="0.33644"
android:valueTo="0.8"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_6" />
</set>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="1000"
android:propertyName="trimPathEnd"
android:valueFrom="0.2"
android:valueTo="0.5"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_7" />
<objectAnimator
android:duration="483"
android:propertyName="trimPathEnd"
android:valueFrom="0.5"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_4" />
<objectAnimator
android:duration="516"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="516"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
<objectAnimator
android:duration="1483"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.8"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_8" />
</set>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="1000"
android:propertyName="trimPathEnd"
android:valueFrom="0.1"
android:valueTo="0.5"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_0" />
<objectAnimator
android:duration="483"
android:propertyName="trimPathEnd"
android:valueFrom="0.5"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_4" />
<objectAnimator
android:duration="516"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="516"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
<objectAnimator
android:duration="483"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.1244"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_3" />
<objectAnimator
android:duration="1000"
android:propertyName="trimPathStart"
android:valueFrom="0.1244"
android:valueTo="0.9"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_2" />
</set>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="1000"
android:propertyName="trimPathEnd"
android:valueFrom="0.1"
android:valueTo="0.5"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_0" />
<objectAnimator
android:duration="483"
android:propertyName="trimPathEnd"
android:valueFrom="0.5"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_4" />
<objectAnimator
android:duration="516"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="516"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_1" />
<objectAnimator
android:duration="1483"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.9"
android:valueType="floatType"
android:interpolator="@anim/circle_loader_animation_interpolator_8" />
</set>
</set>
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
a:name="circle_loader"
a:width="200dp"
a:viewportWidth="200"
a:height="200dp"
a:viewportHeight="200"
tools:targetApi="21">
<group
a:name="circle"
a:translateX="100"
a:translateY="99.5" >
<path
a:name="ellipse_path_1"
a:strokeColor="#FFE8EAEC"
a:strokeWidth="4"
a:pathData="M 0.0,-80.0 c 44.182779984,0.0 80.0,35.817220016 80.0,80.0 c 0.0,44.182779984 -35.817220016,80.0 -80.0,80.0 c -44.182779984,0.0 -80.0,-35.817220016 -80.0,-80.0 c 0.0,-44.182779984 35.817220016,-80.0 80.0,-80.0 Z" />
</group>
<group
a:name="circlegreen"
a:translateX="100"
a:translateY="99.5"
a:rotation="-116" >
<path
a:name="ellipse_path_2"
a:strokeColor="#FF33A752"
a:strokeWidth="4"
a:trimPathEnd="0.2"
a:pathData="M 0.0,-80.0 c 44.182779984,0.0 80.0,35.817220016 80.0,80.0 c 0.0,44.182779984 -35.817220016,80.0 -80.0,80.0 c -44.182779984,0.0 -80.0,-35.817220016 -80.0,-80.0 c 0.0,-44.182779984 35.817220016,-80.0 80.0,-80.0 Z" />
</group>
<group
a:name="circleyellow"
a:translateX="100"
a:translateY="99.5"
a:rotation="-84" >
<path
a:name="ellipse_path_3"
a:strokeColor="#FFFABB05"
a:strokeWidth="4"
a:trimPathEnd="0.2"
a:pathData="M 0.0,-80.0 c 44.182779984,0.0 80.0,35.817220016 80.0,80.0 c 0.0,44.182779984 -35.817220016,80.0 -80.0,80.0 c -44.182779984,0.0 -80.0,-35.817220016 -80.0,-80.0 c 0.0,-44.182779984 35.817220016,-80.0 80.0,-80.0 Z" />
</group>
<group
a:name="circlered"
a:translateX="100"
a:translateY="99.5"
a:rotation="-18" >
<path
a:name="ellipse_path_4"
a:strokeColor="#FFEA4334"
a:strokeWidth="4"
a:trimPathEnd="0.1"
a:pathData="M 0.0,-80.0 c 44.182779984,0.0 80.0,35.817220016 80.0,80.0 c 0.0,44.182779984 -35.817220016,80.0 -80.0,80.0 c -44.182779984,0.0 -80.0,-35.817220016 -80.0,-80.0 c 0.0,-44.182779984 35.817220016,-80.0 80.0,-80.0 Z" />
</group>
<group
a:name="circleblue"
a:translateX="100"
a:translateY="99.5" >
<path
a:name="ellipse_path_5"
a:trimPathEnd="0.1"
a:strokeColor="#FF4185F3"
a:strokeWidth="4"
a:pathData="M 0.0,-80.0 c 44.182779984,0.0 80.0,35.817220016 80.0,80.0 c 0.0,44.182779984 -35.817220016,80.0 -80.0,80.0 c -44.182779984,0.0 -80.0,-35.817220016 -80.0,-80.0 c 0.0,-44.182779984 35.817220016,-80.0 80.0,-80.0 Z" />
</group>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:drawable="@drawable/circle_loader"
tools:targetApi="21">
<target
android:name="circlegreen"
android:animation="@anim/circle_loader_circlegreen_animation" />
<target
android:name="ellipse_path_2"
android:animation="@anim/circle_loader_ellipse_path_2_animation" />
<target
android:name="circleyellow"
android:animation="@anim/circle_loader_circleyellow_animation" />
<target
android:name="ellipse_path_3"
android:animation="@anim/circle_loader_ellipse_path_3_animation" />
<target
android:name="circlered"
android:animation="@anim/circle_loader_circlered_animation" />
<target
android:name="ellipse_path_4"
android:animation="@anim/circle_loader_ellipse_path_4_animation" />
<target
android:name="circleblue"
android:animation="@anim/circle_loader_circleblue_animation" />
<target
android:name="ellipse_path_5"
android:animation="@anim/circle_loader_ellipse_path_5_animation" />
</animated-vector>
<vector xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
a:width="48dp"
a:height="48dp"
a:viewportWidth="48.0"
a:viewportHeight="48.0"
tools:targetApi="21">
<path
a:pathData="M36,16h-2v-4c0,-5.52 -4.48,-10 -10,-10S14,6.48 14,12v4h-2c-2.21,0 -4,1.79 -4,4v20c0,2.21 1.79,4 4,4h24c2.21,0 4,-1.79 4,-4L40,20c0,-2.21 -1.79,-4 -4,-4zM24,34c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4 4,1.79 4,4 -1.79,4 -4,4zM30.2,16L17.8,16v-4c0,-3.42 2.78,-6.2 6.2,-6.2 3.42,0 6.2,2.78 6.2,6.2v4z"
a:fillColor="#4285F4"/>
</vector>
......@@ -3,25 +3,67 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
a:layout_width="match_parent"
a:layout_height="match_parent"
a:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="HardcodedText">
<ImageView
a:id="@+id/logo"
a:layout_width="match_parent"
a:layout_height="24dp"
a:layout_marginTop="56dp"
a:contentDescription="@null"
a:gravity="center_horizontal"
a:src="@drawable/product_logo_name"/>
<TextView
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="HardcodedText"
style="@style/TextAppearance.TextLarge.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Connecting to your computer" />
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:layout_marginTop="24dp"
a:layout_marginLeft="24dp"
a:layout_marginRight="24dp"
a:fontFamily="@font/chrome_google_sans"
a:gravity="center_horizontal"
a:text="Connecting to your device"
a:textColor="@color/modern_grey_900"
a:textSize="24sp"/>
<RelativeLayout
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layoutDirection="ltr"
a:layout_marginTop="52dp"
a:layout_marginLeft="24dp"
a:layout_marginRight="24dp"
a:layout_gravity="center_horizontal">
<ImageView
a:id="@+id/spinner"
a:contentDescription="Spinning circle"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_gravity="center"
a:layout_centerInParent="true"
a:layout_centerVertical="true"/>
<ImageView
a:contentDescription="Lock icon"
a:layout_height="wrap_content"
a:layout_width="wrap_content"
a:src="@drawable/ic_lock_googblue_48dp"
a:layout_centerInParent="true"
a:layout_centerVertical="true"/>
</RelativeLayout>
<TextView
xmlns:tools="http://schemas.android.com/tools"
style="@style/TextAppearance.TextMedium.Secondary"
android:id="@+id/status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" />
a:id="@+id/status_text"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_marginTop="4dp"
a:layout_gravity="center_horizontal"
a:padding="0px"
a:textColor="@color/modern_grey_800"
a:textSize="14sp"/>
</LinearLayout>
......@@ -28,6 +28,8 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
import org.chromium.base.Log;
import org.chromium.ui.base.ActivityAndroidPermissionDelegate;
......@@ -123,6 +125,23 @@ public class CableAuthenticatorUI
case SERVER_LINK:
View v = inflater.inflate(R.layout.cablev2_serverlink, container, false);
mStatusText = v.findViewById(R.id.status_text);
ImageView spinner = (ImageView) v.findViewById(R.id.spinner);
final AnimatedVectorDrawableCompat anim = AnimatedVectorDrawableCompat.create(
getContext(), R.drawable.circle_loader_animation);
// There is no way to make an animation loop. Instead it must be
// manually started each time it completes.
anim.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
@Override
public void onAnimationEnd(Drawable drawable) {
if (drawable != null && drawable.isVisible()) {
anim.start();
}
}
});
spinner.setImageDrawable(anim);
anim.start();
return v;
case QR:
......@@ -230,6 +249,7 @@ public class CableAuthenticatorUI
}
}
@SuppressLint("SetTextI18n")
void onStatus(int code) {
switch (mMode) {
case QR:
......@@ -244,7 +264,15 @@ public class CableAuthenticatorUI
break;
case SERVER_LINK:
mStatusText.setText(String.valueOf(code));
// These values must match up with the Status enum in v2_authenticator.h
// TODO(agl): translate
if (code == 1) {
mStatusText.setText("Waiting for other computer");
} else if (code == 2) {
mStatusText.setText("Connected to other computer");
} else if (code == 3) {
mStatusText.setText("Processing request");
}
break;
case FCM:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment