Merge "Ensure total runtime for time-limited FGS is in uptime base." into main
diff --git a/Ravenwood.bp b/Ravenwood.bp
index 7c7c0e2..74382a6 100644
--- a/Ravenwood.bp
+++ b/Ravenwood.bp
@@ -34,6 +34,7 @@
"--debug-log $(location hoststubgen_framework-minus-apex.log) " +
"--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
+ "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
"--out-impl-jar $(location ravenwood.jar) " +
@@ -58,6 +59,7 @@
"hoststubgen_framework-minus-apex.log",
"hoststubgen_framework-minus-apex_stats.csv",
+ "hoststubgen_framework-minus-apex_apis.csv",
],
visibility: ["//visibility:private"],
}
@@ -90,6 +92,18 @@
],
}
+genrule {
+ name: "framework-minus-apex.ravenwood.apis",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
+ cmd: "cp $(in) $(out)",
+ srcs: [
+ ":framework-minus-apex.ravenwood-base{hoststubgen_framework-minus-apex_apis.csv}",
+ ],
+ out: [
+ "hoststubgen_framework-minus-apex_apis.csv",
+ ],
+}
+
java_library {
name: "services.core-for-hoststubgen",
installable: false, // host only jar.
@@ -108,6 +122,7 @@
"--debug-log $(location hoststubgen_services.core.log) " +
"--stats-file $(location hoststubgen_services.core_stats.csv) " +
+ "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
"--out-impl-jar $(location ravenwood.jar) " +
@@ -132,6 +147,7 @@
"hoststubgen_services.core.log",
"hoststubgen_services.core_stats.csv",
+ "hoststubgen_services.core_apis.csv",
],
visibility: ["//visibility:private"],
}
@@ -161,6 +177,18 @@
],
}
+genrule {
+ name: "services.core.ravenwood.apis",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
+ cmd: "cp $(in) $(out)",
+ srcs: [
+ ":services.core.ravenwood-base{hoststubgen_services.core_apis.csv}",
+ ],
+ out: [
+ "hoststubgen_services.core_apis.csv",
+ ],
+}
+
java_library {
name: "services.core.ravenwood-jarjar",
installable: false,
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 628611d..0372b7b 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -596,6 +596,7 @@
method @Deprecated public int getDeviceOwnerType(@NonNull android.content.ComponentName);
method @Nullable public String getDevicePolicyManagementRoleHolderUpdaterPackage();
method @NonNull public java.util.Set<java.lang.String> getDisallowedSystemApps(@NonNull android.content.ComponentName, int, @NonNull String);
+ method @FlaggedApi("android.app.admin.flags.headless_device_owner_provisioning_fix_enabled") @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public int getHeadlessDeviceOwnerMode();
method public long getLastBugReportRequestTime();
method public long getLastNetworkLogRetrievalTime();
method public long getLastSecurityLogRetrievalTime();
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 9058713..69f29f3 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -58,6 +58,7 @@
import static android.app.admin.flags.Flags.FLAG_DEVICE_THEFT_API_ENABLED;
import static android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED;
import static android.app.admin.flags.Flags.FLAG_DEVICE_POLICY_SIZE_TRACKING_ENABLED;
+import static android.app.admin.flags.Flags.FLAG_HEADLESS_DEVICE_OWNER_PROVISIONING_FIX_ENABLED;
import static android.app.admin.flags.Flags.FLAG_HEADLESS_DEVICE_OWNER_SINGLE_USER_ENABLED;
import static android.app.admin.flags.Flags.FLAG_SECURITY_LOG_V2_ENABLED;
import static android.app.admin.flags.Flags.onboardingBugreportV2Enabled;
@@ -17724,6 +17725,9 @@
*
* @hide
*/
+ @TestApi
+ @FlaggedApi(FLAG_HEADLESS_DEVICE_OWNER_PROVISIONING_FIX_ENABLED)
+ @RequiresPermission(permission.MANAGE_PROFILE_AND_DEVICE_OWNERS)
@DeviceAdminInfo.HeadlessDeviceOwnerMode
public int getHeadlessDeviceOwnerMode() {
if (!Flags.headlessDeviceOwnerProvisioningFixEnabled()) {
diff --git a/core/java/android/companion/CompanionDeviceManager.java b/core/java/android/companion/CompanionDeviceManager.java
index a08d659..e812d81 100644
--- a/core/java/android/companion/CompanionDeviceManager.java
+++ b/core/java/android/companion/CompanionDeviceManager.java
@@ -1884,7 +1884,7 @@
mLocalOut = new ParcelFileDescriptor.AutoCloseOutputStream(localFd);
try {
- mService.attachSystemDataTransport(mContext.getPackageName(),
+ mService.attachSystemDataTransport(mContext.getOpPackageName(),
mContext.getUserId(), mAssociationId, remoteFd);
} catch (RemoteException e) {
throw new IOException("Failed to configure transport", e);
@@ -1921,9 +1921,9 @@
mStopped = true;
try {
- mService.detachSystemDataTransport(mContext.getPackageName(),
+ mService.detachSystemDataTransport(mContext.getOpPackageName(),
mContext.getUserId(), mAssociationId);
- } catch (RemoteException e) {
+ } catch (RemoteException | IllegalArgumentException e) {
Log.w(TAG, "Failed to detach transport", e);
}
diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS
index 90279c6..9f3364f 100644
--- a/core/java/android/os/OWNERS
+++ b/core/java/android/os/OWNERS
@@ -88,6 +88,8 @@
# PerformanceHintManager
per-file PerformanceHintManager.java = file:/ADPF_OWNERS
per-file WorkDuration.java = file:/ADPF_OWNERS
+per-file IHintManager.aidl = file:/ADPF_OWNERS
+per-file IHintSession.aidl = file:/ADPF_OWNERS
# IThermal interfaces
per-file IThermal* = file:/THERMAL_OWNERS
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2a1eb97..8eceffa 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -33942,7 +33942,7 @@
return; // can't vote if not connected
}
float velocity = mFrameContentVelocity;
- float frameRate = mPreferredFrameRate;
+ final float frameRate = mPreferredFrameRate;
ViewParent parent = mParent;
if (velocity <= 0 && Float.isNaN(frameRate)) {
// The most common case is when nothing is set, so this special case is called
@@ -33982,13 +33982,15 @@
}
if (velocityFrameRate > 0f || frameRate > 0f) {
int compatibility;
+ float frameRateToSet;
if (frameRate >= velocityFrameRate) {
compatibility = FRAME_RATE_COMPATIBILITY_FIXED_SOURCE;
+ frameRateToSet = frameRate;
} else {
compatibility = FRAME_RATE_COMPATIBILITY_GTE;
- frameRate = velocityFrameRate;
+ frameRateToSet = velocityFrameRate;
}
- viewRootImpl.votePreferredFrameRate(frameRate, compatibility);
+ viewRootImpl.votePreferredFrameRate(frameRateToSet, compatibility);
}
}
@@ -34052,7 +34054,7 @@
*/
@FlaggedApi(FLAG_VIEW_VELOCITY_API)
public void setFrameContentVelocity(float pixelsPerSecond) {
- if (viewVelocityApi()) {
+ if (mAttachInfo != null && mAttachInfo.mViewVelocityApi) {
mFrameContentVelocity = Math.abs(pixelsPerSecond);
if (sToolkitMetricsForFrameRateDecisionFlagValue) {
@@ -34070,8 +34072,8 @@
*/
@FlaggedApi(FLAG_VIEW_VELOCITY_API)
public float getFrameContentVelocity() {
- if (viewVelocityApi()) {
- return (mFrameContentVelocity < 0f) ? 0f : mFrameContentVelocity;
+ if (mAttachInfo != null && mAttachInfo.mViewVelocityApi) {
+ return Math.max(mFrameContentVelocity, 0f);
}
return 0;
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 52ff142..11ad86c 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -49,7 +49,6 @@
import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.service.autofill.Flags;
import android.util.AttributeSet;
import android.util.IntArray;
import android.util.Log;
@@ -2652,10 +2651,12 @@
// Check for interception.
final boolean intercepted;
- if (actionMasked == MotionEvent.ACTION_DOWN
- || mFirstTouchTarget != null) {
+ ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (actionMasked == MotionEvent.ACTION_DOWN || mFirstTouchTarget != null) {
final boolean disallowIntercept = (mGroupFlags & FLAG_DISALLOW_INTERCEPT) != 0;
- if (!disallowIntercept) {
+ final boolean isDispatchingBack = (viewRootImpl != null
+ && viewRootImpl.getOnBackInvokedDispatcher().isDispatching());
+ if (!disallowIntercept || isDispatchingBack) { // Allow back to intercept touch
intercepted = onInterceptTouchEvent(ev);
ev.setAction(action); // restore action in case it was changed
} else {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 84cde0d..dbb42a0 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1282,7 +1282,7 @@
mImeFocusController = new ImeFocusController(this);
mScrollCaptureRequestTimeout = SCROLL_CAPTURE_REQUEST_TIMEOUT_MILLIS;
- mOnBackInvokedDispatcher = new WindowOnBackInvokedDispatcher(context);
+ mOnBackInvokedDispatcher = new WindowOnBackInvokedDispatcher(context, Looper.myLooper());
if (sensitiveContentAppProtection()) {
mSensitiveContentProtectionService =
ISensitiveContentProtectionManager.Stub.asInterface(
diff --git a/core/java/android/view/flags/refresh_rate_flags.aconfig b/core/java/android/view/flags/refresh_rate_flags.aconfig
index d0fe3e0..e3054da 100644
--- a/core/java/android/view/flags/refresh_rate_flags.aconfig
+++ b/core/java/android/view/flags/refresh_rate_flags.aconfig
@@ -61,7 +61,7 @@
name: "toolkit_frame_rate_default_normal_read_only"
namespace: "toolkit"
description: "Feature flag for setting frame rate category as NORMAL for default"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -69,7 +69,7 @@
name: "toolkit_frame_rate_by_size_read_only"
namespace: "toolkit"
description: "Feature flag for setting frame rate category based on size"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -77,7 +77,7 @@
name: "toolkit_frame_rate_velocity_mapping_read_only"
namespace: "toolkit"
description: "Feature flag for setting frame rate based on velocity"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -85,7 +85,7 @@
name: "toolkit_frame_rate_small_uses_percent_read_only"
namespace: "toolkit"
description: "VRR uses percent of size to consider a view to be small"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -93,7 +93,7 @@
name: "toolkit_frame_rate_typing_read_only"
namespace: "toolkit"
description: "Feature flag for suppressing boost on typing"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -101,7 +101,7 @@
name: "toolkit_frame_rate_function_enabling_read_only"
namespace: "toolkit"
description: "Feature flag to enable the functionality of the dVRR feature"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
@@ -109,6 +109,6 @@
name: "toolkit_frame_rate_view_enabling_read_only"
namespace: "toolkit"
description: "Feature flag to enable the functionality on views for the dVRR feature"
- bug: "239979904"
+ bug: "335874198"
is_fixed_read_only: true
}
\ No newline at end of file
diff --git a/core/java/android/widget/flags/notification_widget_flags.aconfig b/core/java/android/widget/flags/notification_widget_flags.aconfig
index 95794f3..3a39631 100644
--- a/core/java/android/widget/flags/notification_widget_flags.aconfig
+++ b/core/java/android/widget/flags/notification_widget_flags.aconfig
@@ -37,3 +37,13 @@
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "big_picture_style_discard_empty_icon_bitmap_drawables"
+ namespace: "systemui"
+ description: "BigPictureStyle: Ignore Icon BitmapDrawables without Bitmaps"
+ bug: "335878768"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java b/core/java/android/window/BackTouchTracker.java
similarity index 74%
rename from libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java
rename to core/java/android/window/BackTouchTracker.java
index 8f04f12..eb23af2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java
+++ b/core/java/android/window/BackTouchTracker.java
@@ -14,22 +14,21 @@
* limitations under the License.
*/
-package com.android.wm.shell.back;
+package android.window;
import android.annotation.FloatRange;
import android.os.SystemProperties;
import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
-import android.window.BackEvent;
-import android.window.BackMotionEvent;
import java.io.PrintWriter;
/**
* Helper class to record the touch location for gesture and generate back events.
+ * @hide
*/
-class TouchTracker {
+public class BackTouchTracker {
private static final String PREDICTIVE_BACK_LINEAR_DISTANCE_PROP =
"persist.wm.debug.predictive_back_linear_distance";
private static final int LINEAR_DISTANCE = SystemProperties
@@ -53,9 +52,13 @@
private float mLatestVelocityY;
private float mStartThresholdX;
private int mSwipeEdge;
+ private boolean mShouldUpdateStartLocation = false;
private TouchTrackerState mState = TouchTrackerState.INITIAL;
- void update(float touchX, float touchY, float velocityX, float velocityY) {
+ /**
+ * Updates the tracker with a new motion event.
+ */
+ public void update(float touchX, float touchY, float velocityX, float velocityY) {
/**
* If back was previously cancelled but the user has started swiping in the forward
* direction again, restart back.
@@ -74,34 +77,52 @@
mLatestVelocityY = velocityY;
}
- void setTriggerBack(boolean triggerBack) {
+ /** Sets whether the back gesture is past the trigger threshold. */
+ public void setTriggerBack(boolean triggerBack) {
if (mTriggerBack != triggerBack && !triggerBack) {
mStartThresholdX = mLatestTouchX;
}
mTriggerBack = triggerBack;
}
- boolean getTriggerBack() {
+ /** Gets whether the back gesture is past the trigger threshold. */
+ public boolean getTriggerBack() {
return mTriggerBack;
}
- void setState(TouchTrackerState state) {
+
+ /** Returns if the start location should be updated. */
+ public boolean shouldUpdateStartLocation() {
+ return mShouldUpdateStartLocation;
+ }
+
+ /** Sets if the start location should be updated. */
+ public void setShouldUpdateStartLocation(boolean shouldUpdate) {
+ mShouldUpdateStartLocation = shouldUpdate;
+ }
+
+ /** Sets the state of the touch tracker. */
+ public void setState(TouchTrackerState state) {
mState = state;
}
- boolean isInInitialState() {
+ /** Returns if the tracker is in initial state. */
+ public boolean isInInitialState() {
return mState == TouchTrackerState.INITIAL;
}
- boolean isActive() {
+ /** Returns if a back gesture is active. */
+ public boolean isActive() {
return mState == TouchTrackerState.ACTIVE;
}
- boolean isFinished() {
+ /** Returns if a back gesture has been finished. */
+ public boolean isFinished() {
return mState == TouchTrackerState.FINISHED;
}
- void setGestureStartLocation(float touchX, float touchY, int swipeEdge) {
+ /** Sets the start location of the back gesture. */
+ public void setGestureStartLocation(float touchX, float touchY, int swipeEdge) {
mInitTouchX = touchX;
mInitTouchY = touchY;
mLatestTouchX = touchX;
@@ -110,25 +131,27 @@
mStartThresholdX = mInitTouchX;
}
- /** Update the start location used to compute the progress
- * to the latest touch location.
- */
- void updateStartLocation() {
+ /** Update the start location used to compute the progress to the latest touch location. */
+ public void updateStartLocation() {
mInitTouchX = mLatestTouchX;
mInitTouchY = mLatestTouchY;
mStartThresholdX = mInitTouchX;
+ mShouldUpdateStartLocation = false;
}
- void reset() {
+ /** Resets the tracker. */
+ public void reset() {
mInitTouchX = 0;
mInitTouchY = 0;
mStartThresholdX = 0;
mTriggerBack = false;
mState = TouchTrackerState.INITIAL;
mSwipeEdge = BackEvent.EDGE_LEFT;
+ mShouldUpdateStartLocation = false;
}
- BackMotionEvent createStartEvent(RemoteAnimationTarget target) {
+ /** Creates a start {@link BackMotionEvent}. */
+ public BackMotionEvent createStartEvent(RemoteAnimationTarget target) {
return new BackMotionEvent(
/* touchX = */ mInitTouchX,
/* touchY = */ mInitTouchY,
@@ -140,7 +163,8 @@
/* departingAnimationTarget = */ target);
}
- BackMotionEvent createProgressEvent() {
+ /** Creates a progress {@link BackMotionEvent}. */
+ public BackMotionEvent createProgressEvent() {
float progress = getProgress(mLatestTouchX);
return createProgressEvent(progress);
}
@@ -152,7 +176,7 @@
* @return progress value
*/
@FloatRange(from = 0.0, to = 1.0)
- float getProgress(float touchX) {
+ public float getProgress(float touchX) {
// If back is committed, progress is the distance between the last and first touch
// point, divided by the max drag distance. Otherwise, it's the distance between
// the last touch point and the starting threshold, divided by max drag distance.
@@ -200,11 +224,20 @@
* Maximum distance in pixels.
* Progress is considered to be completed (1f) when this limit is exceeded.
*/
- float getMaxDistance() {
+ public float getMaxDistance() {
return mMaxDistance;
}
- BackMotionEvent createProgressEvent(float progress) {
+ public float getLinearDistance() {
+ return mLinearDistance;
+ }
+
+ public float getNonLinearFactor() {
+ return mNonLinearFactor;
+ }
+
+ /** Creates a progress {@link BackMotionEvent} for the given progress. */
+ public BackMotionEvent createProgressEvent(float progress) {
return new BackMotionEvent(
/* touchX = */ mLatestTouchX,
/* touchY = */ mLatestTouchY,
@@ -216,6 +249,7 @@
/* departingAnimationTarget = */ null);
}
+ /** Sets the thresholds for computing progress. */
public void setProgressThresholds(float linearDistance, float maxDistance,
float nonLinearFactor) {
if (LINEAR_DISTANCE >= 0) {
@@ -227,13 +261,14 @@
mNonLinearFactor = nonLinearFactor;
}
- void dump(PrintWriter pw, String prefix) {
- pw.println(prefix + "TouchTracker state:");
+ /** Dumps debugging info. */
+ public void dump(PrintWriter pw, String prefix) {
+ pw.println(prefix + "BackTouchTracker state:");
pw.println(prefix + " mState=" + mState);
pw.println(prefix + " mTriggerBack=" + mTriggerBack);
}
- enum TouchTrackerState {
+ public enum TouchTrackerState {
INITIAL, ACTIVE, FINISHED
}
diff --git a/core/java/android/window/IOnBackInvokedCallback.aidl b/core/java/android/window/IOnBackInvokedCallback.aidl
index 159c0e8..e07d4a9 100644
--- a/core/java/android/window/IOnBackInvokedCallback.aidl
+++ b/core/java/android/window/IOnBackInvokedCallback.aidl
@@ -56,4 +56,9 @@
* Wraps {@link OnBackInvokedCallback#onBackInvoked()}.
*/
void onBackInvoked();
+
+ /**
+ * Sets whether the back gesture is past the trigger threshold.
+ */
+ void setTriggerBack(in boolean triggerBack);
}
diff --git a/core/java/android/window/ImeOnBackInvokedDispatcher.java b/core/java/android/window/ImeOnBackInvokedDispatcher.java
index da1993d..ee6ba24 100644
--- a/core/java/android/window/ImeOnBackInvokedDispatcher.java
+++ b/core/java/android/window/ImeOnBackInvokedDispatcher.java
@@ -48,10 +48,17 @@
static final String RESULT_KEY_PRIORITY = "priority";
static final int RESULT_CODE_REGISTER = 0;
static final int RESULT_CODE_UNREGISTER = 1;
+ static final int RESULT_CODE_START_DISPATCHING = 2;
+ static final int RESULT_CODE_STOP_DISPATCHING = 3;
@NonNull
private final ResultReceiver mResultReceiver;
@NonNull
private final BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
+ @NonNull
+ private final BackTouchTracker mTouchTracker = new BackTouchTracker();
+ // The handler to run callbacks on. This should be on the same thread
+ // the ViewRootImpl holding IME's WindowOnBackInvokedDispatcher is created on.
+ private Handler mHandler;
public ImeOnBackInvokedDispatcher(Handler handler) {
mResultReceiver = new ResultReceiver(handler) {
@@ -78,6 +85,10 @@
mResultReceiver = in.readTypedObject(ResultReceiver.CREATOR);
}
+ void setHandler(@NonNull Handler handler) {
+ mHandler = handler;
+ }
+
@Override
public void registerOnBackInvokedCallback(
@OnBackInvokedDispatcher.Priority int priority,
@@ -89,8 +100,13 @@
// the app process, which may treat the IME callback as weakly referenced. This will not
// cause a memory leak because the app side already clears the reference correctly.
final IOnBackInvokedCallback iCallback =
- new WindowOnBackInvokedDispatcher.OnBackInvokedCallbackWrapper(
- callback, mProgressAnimator, false /* useWeakRef */);
+ new ImeOnBackInvokedCallbackWrapper(
+ callback,
+ mTouchTracker,
+ mProgressAnimator,
+ this,
+ mHandler != null ? mHandler : Handler.getMain(),
+ false /* useWeakRef */);
bundle.putBinder(RESULT_KEY_CALLBACK, iCallback.asBinder());
bundle.putInt(RESULT_KEY_PRIORITY, priority);
bundle.putInt(RESULT_KEY_ID, callback.hashCode());
@@ -115,6 +131,12 @@
dest.writeTypedObject(mResultReceiver, flags);
}
+ /** Sets the progress thresholds for touch tracking */
+ public void setProgressThresholds(float linearDistance, float maxDistance,
+ float nonLinearFactor) {
+ mTouchTracker.setProgressThresholds(linearDistance, maxDistance, nonLinearFactor);
+ }
+
@NonNull
public static final Parcelable.Creator<ImeOnBackInvokedDispatcher> CREATOR =
new Parcelable.Creator<ImeOnBackInvokedDispatcher>() {
@@ -131,15 +153,20 @@
private void receive(
int resultCode, Bundle resultData,
@NonNull WindowOnBackInvokedDispatcher receivingDispatcher) {
- final int callbackId = resultData.getInt(RESULT_KEY_ID);
if (resultCode == RESULT_CODE_REGISTER) {
+ final int callbackId = resultData.getInt(RESULT_KEY_ID);
int priority = resultData.getInt(RESULT_KEY_PRIORITY);
final IOnBackInvokedCallback callback = IOnBackInvokedCallback.Stub.asInterface(
resultData.getBinder(RESULT_KEY_CALLBACK));
registerReceivedCallback(
callback, priority, callbackId, receivingDispatcher);
} else if (resultCode == RESULT_CODE_UNREGISTER) {
+ final int callbackId = resultData.getInt(RESULT_KEY_ID);
unregisterReceivedCallback(callbackId, receivingDispatcher);
+ } else if (resultCode == RESULT_CODE_START_DISPATCHING) {
+ receiveStartDispatching(receivingDispatcher);
+ } else if (resultCode == RESULT_CODE_STOP_DISPATCHING) {
+ receiveStopDispatching(receivingDispatcher);
}
}
@@ -181,6 +208,63 @@
mImeCallbacks.remove(callback);
}
+ static class ImeOnBackInvokedCallbackWrapper extends
+ WindowOnBackInvokedDispatcher.OnBackInvokedCallbackWrapper {
+ @NonNull
+ private final ImeOnBackInvokedDispatcher mDispatcher;
+
+ ImeOnBackInvokedCallbackWrapper(
+ @NonNull OnBackInvokedCallback callback,
+ @NonNull BackTouchTracker touchTracker,
+ @NonNull BackProgressAnimator progressAnimator,
+ @NonNull ImeOnBackInvokedDispatcher dispatcher,
+ @NonNull Handler handler,
+ boolean useWeakRef) {
+ super(callback, touchTracker, progressAnimator, handler, useWeakRef);
+ mDispatcher = dispatcher;
+ }
+
+ @Override
+ public void onBackStarted(BackMotionEvent backEvent) {
+ super.onBackStarted(backEvent);
+ mDispatcher.sendStartDispatching();
+ }
+
+ @Override
+ public void onBackCancelled() {
+ super.onBackCancelled();
+ mDispatcher.sendStopDispatching();
+ }
+
+ @Override
+ public void onBackInvoked() throws RemoteException {
+ super.onBackInvoked();
+ mDispatcher.sendStopDispatching();
+ }
+ }
+
+ /** Notifies the app process that we've stopped dispatching to an IME callback */
+ private void sendStopDispatching() {
+ mResultReceiver.send(RESULT_CODE_STOP_DISPATCHING, null /* unused bundle */);
+ }
+
+ /** Notifies the app process that we've started dispatching to an IME callback */
+ private void sendStartDispatching() {
+ mResultReceiver.send(RESULT_CODE_START_DISPATCHING, null /* unused bundle */);
+ }
+
+ /** Receives IME's message that dispatching has started. */
+ private void receiveStopDispatching(
+ @NonNull WindowOnBackInvokedDispatcher receivingDispatcher) {
+ receivingDispatcher.onStopImeDispatching();
+ }
+
+ /** Receives IME's message that dispatching has stopped. */
+ private void receiveStartDispatching(
+ @NonNull WindowOnBackInvokedDispatcher receivingDispatcher) {
+ receivingDispatcher.onStartImeDispatching();
+ }
+
/** Clears all registered callbacks on the instance. */
public void clear() {
// Unregister previously registered callbacks if there's any.
@@ -193,6 +277,7 @@
// We should also stop running animations since all callbacks have been removed.
// note: mSpring.skipToEnd(), in ProgressAnimator.reset(), requires the main handler.
Handler.getMain().post(mProgressAnimator::reset);
+ sendStopDispatching();
}
static class ImeOnBackInvokedCallback implements OnBackInvokedCallback {
diff --git a/core/java/android/window/WindowOnBackInvokedDispatcher.java b/core/java/android/window/WindowOnBackInvokedDispatcher.java
index 47a4052..7f6678e 100644
--- a/core/java/android/window/WindowOnBackInvokedDispatcher.java
+++ b/core/java/android/window/WindowOnBackInvokedDispatcher.java
@@ -23,19 +23,24 @@
import android.content.ContextWrapper;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
+import android.content.res.Configuration;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Handler;
+import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
+import android.util.TypedValue;
import android.view.IWindow;
import android.view.IWindowSession;
import android.view.ImeBackAnimationController;
+import android.view.MotionEvent;
import androidx.annotation.VisibleForTesting;
-
+import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import java.io.PrintWriter;
@@ -63,6 +68,14 @@
public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher {
private IWindowSession mWindowSession;
private IWindow mWindow;
+ @VisibleForTesting
+ public final BackTouchTracker mTouchTracker = new BackTouchTracker();
+ @VisibleForTesting
+ public final BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
+ // The handler to run callbacks on.
+ // This should be on the same thread the ViewRootImpl holding this instance is created on.
+ @NonNull
+ private final Handler mHandler;
private static final String TAG = "WindowOnBackDispatcher";
private static final boolean ENABLE_PREDICTIVE_BACK = SystemProperties
.getInt("persist.wm.debug.predictive_back", 1) != 0;
@@ -86,11 +99,35 @@
@GuardedBy("mLock")
public final TreeMap<Integer, ArrayList<OnBackInvokedCallback>>
mOnBackInvokedCallbacks = new TreeMap<>();
+
private Checker mChecker;
private final Object mLock = new Object();
+ // The threshold for back swipe full progress.
+ private float mBackSwipeLinearThreshold;
+ private float mNonLinearProgressFactor;
+ private boolean mImeDispatchingActive;
- public WindowOnBackInvokedDispatcher(@NonNull Context context) {
+ public WindowOnBackInvokedDispatcher(@NonNull Context context, Looper looper) {
mChecker = new Checker(context);
+ mHandler = new Handler(looper);
+ }
+
+ /** Updates the dispatcher state on a new {@link MotionEvent}. */
+ public void onMotionEvent(MotionEvent ev) {
+ if (!isDispatching() || ev == null || ev.getAction() != MotionEvent.ACTION_MOVE) {
+ return;
+ }
+ mTouchTracker.update(ev.getX(), ev.getY(), Float.NaN, Float.NaN);
+ if (mTouchTracker.shouldUpdateStartLocation()) {
+ // Reset the start location on the first event after starting back, so that
+ // the beginning of the animation feels smooth.
+ mTouchTracker.updateStartLocation();
+ }
+ if (!mProgressAnimator.isBackAnimationInProgress()) {
+ return;
+ }
+ final BackMotionEvent backEvent = mTouchTracker.createProgressEvent();
+ mProgressAnimator.onBackProgressed(backEvent);
}
/**
@@ -207,19 +244,7 @@
*/
public boolean isDispatching() {
synchronized (mLock) {
- return mIsDispatching;
- }
- }
-
- private void onStartDispatching() {
- synchronized (mLock) {
- mIsDispatching = true;
- }
- }
-
- private void onStopDispatching() {
- synchronized (mLock) {
- mIsDispatching = false;
+ return mTouchTracker.isActive() || mImeDispatchingActive;
}
}
@@ -263,7 +288,7 @@
// We should also stop running animations since all callbacks have been removed.
// note: mSpring.skipToEnd(), in ProgressAnimator.reset(), requires the main handler.
- Handler.getMain().post(mProgressAnimator::reset);
+ mHandler.post(mProgressAnimator::reset);
mAllCallbacks.clear();
mOnBackInvokedCallbacks.clear();
}
@@ -284,8 +309,9 @@
callback).getIOnBackInvokedCallback()
: new OnBackInvokedCallbackWrapper(
callback,
+ mTouchTracker,
mProgressAnimator,
- this);
+ mHandler);
callbackInfo = new OnBackInvokedCallbackInfo(
iCallback,
priority,
@@ -312,10 +338,6 @@
return null;
}
- @NonNull
- private final BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
- private boolean mIsDispatching = false;
-
/**
* The {@link Context} in ViewRootImp and Activity could be different, this will make sure it
* could update the checker condition base on the real context when binding the proxy
@@ -323,6 +345,26 @@
*/
public void updateContext(@NonNull Context context) {
mChecker = new Checker(context);
+ // Set swipe threshold values.
+ Resources res = context.getResources();
+ mBackSwipeLinearThreshold =
+ res.getDimension(R.dimen.navigation_edge_action_progress_threshold);
+ TypedValue typedValue = new TypedValue();
+ res.getValue(R.dimen.back_progress_non_linear_factor, typedValue, true);
+ mNonLinearProgressFactor = typedValue.getFloat();
+ onConfigurationChanged(context.getResources().getConfiguration());
+ }
+
+ /** Updates the threshold values for computing progress. */
+ public void onConfigurationChanged(Configuration configuration) {
+ float maxDistance = configuration.windowConfiguration.getMaxBounds().width();
+ float linearDistance = Math.min(maxDistance, mBackSwipeLinearThreshold);
+ mTouchTracker.setProgressThresholds(
+ linearDistance, maxDistance, mNonLinearProgressFactor);
+ if (mImeDispatcher != null) {
+ mImeDispatcher.setProgressThresholds(
+ linearDistance, maxDistance, mNonLinearProgressFactor);
+ }
}
/**
@@ -354,6 +396,24 @@
}
}
+ /**
+ * Called when we start dispatching to a callback registered from IME.
+ */
+ public void onStartImeDispatching() {
+ synchronized (mLock) {
+ mImeDispatchingActive = true;
+ }
+ }
+
+ /**
+ * Called when we stop dispatching to a callback registered from IME.
+ */
+ public void onStopImeDispatching() {
+ synchronized (mLock) {
+ mImeDispatchingActive = false;
+ }
+ }
+
static class OnBackInvokedCallbackWrapper extends IOnBackInvokedCallback.Stub {
static class CallbackRef {
final WeakReference<OnBackInvokedCallback> mWeakRef;
@@ -376,83 +436,81 @@
}
}
final CallbackRef mCallbackRef;
- /**
- * The dispatcher this callback is registered with.
- * This can be null for callbacks on {@link ImeOnBackInvokedDispatcher} because they are
- * forwarded and registered on the app's {@link WindowOnBackInvokedDispatcher}. */
- @Nullable
- private final WindowOnBackInvokedDispatcher mDispatcher;
@NonNull
private final BackProgressAnimator mProgressAnimator;
+ @NonNull
+ private final BackTouchTracker mTouchTracker;
+ @NonNull
+ private final Handler mHandler;
OnBackInvokedCallbackWrapper(
@NonNull OnBackInvokedCallback callback,
+ @NonNull BackTouchTracker touchTracker,
@NonNull BackProgressAnimator progressAnimator,
- WindowOnBackInvokedDispatcher dispatcher) {
+ @NonNull Handler handler) {
mCallbackRef = new CallbackRef(callback, true /* useWeakRef */);
+ mTouchTracker = touchTracker;
mProgressAnimator = progressAnimator;
- mDispatcher = dispatcher;
+ mHandler = handler;
}
OnBackInvokedCallbackWrapper(
@NonNull OnBackInvokedCallback callback,
+ @NonNull BackTouchTracker touchTracker,
@NonNull BackProgressAnimator progressAnimator,
+ @NonNull Handler handler,
boolean useWeakRef) {
mCallbackRef = new CallbackRef(callback, useWeakRef);
+ mTouchTracker = touchTracker;
mProgressAnimator = progressAnimator;
- mDispatcher = null;
+ mHandler = handler;
}
@Override
public void onBackStarted(BackMotionEvent backEvent) {
- Handler.getMain().post(() -> {
- if (mDispatcher != null) {
- mDispatcher.onStartDispatching();
- }
+ mHandler.post(() -> {
+ mTouchTracker.setState(BackTouchTracker.TouchTrackerState.ACTIVE);
+ mTouchTracker.setShouldUpdateStartLocation(true);
+ mTouchTracker.setGestureStartLocation(
+ backEvent.getTouchX(), backEvent.getTouchY(), backEvent.getSwipeEdge());
+
final OnBackAnimationCallback callback = getBackAnimationCallback();
if (callback != null) {
- mProgressAnimator.reset();
callback.onBackStarted(new BackEvent(
- backEvent.getTouchX(), backEvent.getTouchY(),
- backEvent.getProgress(), backEvent.getSwipeEdge()));
+ backEvent.getTouchX(),
+ backEvent.getTouchY(),
+ backEvent.getProgress(),
+ backEvent.getSwipeEdge()));
mProgressAnimator.onBackStarted(backEvent, callback::onBackProgressed);
}
});
}
@Override
- public void onBackProgressed(BackMotionEvent backEvent) {
- Handler.getMain().post(() -> {
- final OnBackAnimationCallback callback = getBackAnimationCallback();
- if (callback != null) {
- mProgressAnimator.onBackProgressed(backEvent);
- }
- });
- }
+ public void onBackProgressed(BackMotionEvent backEvent) { }
@Override
public void onBackCancelled() {
- Handler.getMain().post(() -> {
- if (mDispatcher != null) {
- mDispatcher.onStopDispatching();
+ mHandler.post(() -> {
+ final OnBackAnimationCallback callback = getBackAnimationCallback();
+ if (callback == null) {
+ mTouchTracker.reset();
+ return;
}
mProgressAnimator.onBackCancelled(() -> {
- final OnBackAnimationCallback callback = getBackAnimationCallback();
- if (callback != null) {
- callback.onBackCancelled();
- }
+ mTouchTracker.reset();
+ callback.onBackCancelled();
});
});
}
@Override
public void onBackInvoked() throws RemoteException {
- Handler.getMain().post(() -> {
- if (mDispatcher != null) {
- mDispatcher.onStopDispatching();
- }
+ mHandler.post(() -> {
+ mTouchTracker.reset();
boolean isInProgress = mProgressAnimator.isBackAnimationInProgress();
mProgressAnimator.reset();
+ // TODO(b/333957271): Re-introduce auto fling progress generation.
final OnBackInvokedCallback callback = mCallbackRef.get();
if (callback == null) {
Log.d(TAG, "Trying to call onBackInvoked() on a null callback reference.");
@@ -466,6 +524,11 @@
});
}
+ @Override
+ public void setTriggerBack(boolean triggerBack) throws RemoteException {
+ mTouchTracker.setTriggerBack(triggerBack);
+ }
+
@Nullable
private OnBackAnimationCallback getBackAnimationCallback() {
OnBackInvokedCallback callback = mCallbackRef.get();
@@ -498,6 +561,11 @@
public void setImeOnBackInvokedDispatcher(
@NonNull ImeOnBackInvokedDispatcher imeDispatcher) {
mImeDispatcher = imeDispatcher;
+ mImeDispatcher.setHandler(mHandler);
+ mImeDispatcher.setProgressThresholds(
+ mTouchTracker.getLinearDistance(),
+ mTouchTracker.getMaxDistance(),
+ mTouchTracker.getNonLinearFactor());
}
/** Returns true if a non-null {@link ImeOnBackInvokedDispatcher} has been set. **/
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index ab37252..f4315e3 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -521,6 +521,13 @@
}
ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (viewRootImpl != null) {
+ viewRootImpl.getOnBackInvokedDispatcher().onMotionEvent(event);
+ // Intercept touch if back dispatching is active.
+ if (viewRootImpl.getOnBackInvokedDispatcher().isDispatching()) {
+ return true;
+ }
+ }
if (viewRootImpl != null && mWearGestureInterceptionDetector != null) {
boolean wasIntercepting = mWearGestureInterceptionDetector.isIntercepting();
boolean intercepting = mWearGestureInterceptionDetector.onInterceptTouchEvent(event);
@@ -2125,6 +2132,11 @@
super.onConfigurationChanged(newConfig);
initializeElevation();
+
+ ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (viewRootImpl != null) {
+ viewRootImpl.getOnBackInvokedDispatcher().onConfigurationChanged(newConfig);
+ }
}
@Override
diff --git a/core/java/com/android/internal/widget/BigPictureNotificationImageView.java b/core/java/com/android/internal/widget/BigPictureNotificationImageView.java
index 7e7aba2..1fff0c0 100644
--- a/core/java/com/android/internal/widget/BigPictureNotificationImageView.java
+++ b/core/java/com/android/internal/widget/BigPictureNotificationImageView.java
@@ -22,6 +22,7 @@
import android.annotation.StyleRes;
import android.app.ActivityManager;
import android.content.Context;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
@@ -29,6 +30,7 @@
import android.util.Log;
import android.widget.ImageView;
import android.widget.RemoteViews;
+import android.widget.flags.Flags;
import com.android.internal.R;
@@ -119,6 +121,22 @@
return () -> setImageDrawable(drawable);
}
+ @Override
+ public void setImageDrawable(@Nullable Drawable drawable) {
+ if (drawable instanceof BitmapDrawable bitmapDrawable) {
+ if (bitmapDrawable.getBitmap() == null) {
+ if (Flags.bigPictureStyleDiscardEmptyIconBitmapDrawables()) {
+ Log.e(TAG, "discarding BitmapDrawable with null Bitmap (invalid image file?)");
+ drawable = null;
+ } else {
+ Log.e(TAG, "setting BitmapDrawable with null Bitmap (invalid image file?)");
+ }
+ }
+ }
+
+ super.setImageDrawable(drawable);
+ }
+
private Drawable loadImage(Uri uri) {
if (uri == null) return null;
return LocalImageResolver.resolveImage(uri, mContext, mMaximumDrawableWidth,
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 567844c..389e087 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -298,6 +298,9 @@
<protected-broadcast android:name="android.hardware.display.action.WIFI_DISPLAY_STATUS_CHANGED" />
+ <protected-broadcast android:name="android.hardware.hdmi.action.OSD_MESSAGE" />
+ <protected-broadcast android:name="android.hardware.hdmi.action.ON_ACTIVE_SOURCE_RECOVERED_DISMISS_UI" />
+
<protected-broadcast android:name="android.hardware.usb.action.USB_STATE" />
<protected-broadcast android:name="android.hardware.usb.action.USB_PORT_CHANGED" />
<protected-broadcast android:name="android.hardware.usb.action.USB_PORT_COMPLIANCE_CHANGED" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index cfe96c5..b5256f8 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4831,7 +4831,7 @@
See android.credentials.CredentialManager
-->
- <string name="config_defaultCredentialManagerAutofillService" translatable="false"></string>
+ <string name="config_defaultCredentialManagerAutofillService" translatable="false">com.android.credentialmanager/com.android.credentialmanager.autofill.CredentialAutofillService</string>
<!-- The component name(s), flattened to a string, for the system's credential manager
provider services. These services allow retrieving and storing credentials.
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 4aa741d..52ce993 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -1043,4 +1043,10 @@
<dimen name="handwriting_bounds_offset_top">40dp</dimen>
<dimen name="handwriting_bounds_offset_right">10dp</dimen>
<dimen name="handwriting_bounds_offset_bottom">40dp</dimen>
+
+ <!-- The threshold for full back swipe progress. -->
+ <dimen name="navigation_edge_action_progress_threshold">412dp</dimen>
+ <!-- The non-linear progress interval when the screen is wider than the
+ navigation_edge_action_progress_threshold. -->
+ <item name="back_progress_non_linear_factor" format="float" type="dimen">0.2</item>
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index e96240d..2f9f4df 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -399,28 +399,37 @@
<string name="cfTemplateRegisteredTime"><xliff:g id="bearer_service_code">{0}</xliff:g>: Not forwarded</string>
<!-- Title of the cellular network security safety center source's status. -->
- <string name="scCellularNetworkSecurityTitle">Cellular network security</string>
+ <string name="scCellularNetworkSecurityTitle">Mobile network security</string>
<!-- Summary of the cellular network security safety center source's status. -->
- <string name="scCellularNetworkSecuritySummary">Review settings</string>
+ <string name="scCellularNetworkSecuritySummary">Encryption, notifications for unencrypted networks</string>
<!-- Link passed to safety center for the Learn More button on notifications -->
<!-- DO NOT TRANSLATE -->
<string name="scCellularNetworkSecurityLearnMore" translatable="false"></string>
<!-- Title of the safety center issue and notification when the phone's identifier is shared over the network. -->
- <string name="scIdentifierDisclosureIssueTitle">Device identifier accessed</string>
- <!-- Summary of the safety center issue and notification when the phone's identifier is shared over the network. -->
- <string name="scIdentifierDisclosureIssueSummary">A network on the <xliff:g id="disclosure_network">%4$s</xliff:g> connection recorded your device\'s unique identifier (IMSI) <xliff:g id="disclosure_count">%1$d</xliff:g> times in the period between <xliff:g id="disclosure_window_start_time">%2$tr</xliff:g> and <xliff:g id="disclosure_window_end_time">%3$tr</xliff:g>.</string>
+ <string name="scIdentifierDisclosureIssueTitle">Device ID accessed</string>
+ <!-- Summary of the safety center notification when the phone's identifier is shared over the network. -->
+ <string name="scIdentifierDisclosureIssueSummaryNotification">At <xliff:g id="disclosure_time">%1$s</xliff:g>, a nearby network recorded your device\'s unique ID (IMSI or IMEI) while using your <xliff:g id="disclosure_network">%2$s</xliff:g> SIM</string>
+ <!-- Summary of the safety center detail card when the phone's identifier is shared over the network. -->
+ <string name="scIdentifierDisclosureIssueSummary">At <xliff:g id="disclosure_time">%1$s</xliff:g>, a nearby network recorded your device\'s unique ID (IMSI or IMEI) while using your <xliff:g id="disclosure_network">%2$s</xliff:g> SIM.\n\nThis means that your location, activity, or identity have been logged. This is common practice but may be an issue for people concerned about privacy.</string>
+
<!-- Title of the safety center issue and notification when the phone restores an encrypted connection to the network. -->
- <string name="scNullCipherIssueEncryptedTitle">Encrypted connection to <xliff:g id="network_name">%1$s</xliff:g></string>
+ <string name="scNullCipherIssueEncryptedTitle">Connected to encrypted network <xliff:g id="network_name">%1$s</xliff:g></string>
<!-- Summary of the safety center issue and notification when the phone restores an encrypted connection to the network. -->
- <string name="scNullCipherIssueEncryptedSummary">You\'re now connected to a more secure cellular network.</string>
+ <string name="scNullCipherIssueEncryptedSummary"><xliff:g id="network_name">%1$s</xliff:g> SIM connection is more secure now</string>
<!-- Title of the safety center issue and notification when a connected network is not using encryption. -->
- <string name="scNullCipherIssueNonEncryptedTitle">Non-encrypted connection to <xliff:g id="network_name">%1$s</xliff:g></string>
- <!-- Summary of the safety center issue and notification when a connected network is not using encryption. -->
- <string name="scNullCipherIssueNonEncryptedSummary">You\'re connected to a non-encrypted cellular network. Your calls, messages, and data are vulnerable to interception.</string>
+
+ <string name="scNullCipherIssueNonEncryptedTitle">Connected to unencrypted network</string>
+ <!-- Summary of the safety center notification when a connected network is not using encryption. -->
+ <string name="scNullCipherIssueNonEncryptedSummaryNotification">Calls, messages, and data are currently more vulnerable while using your <xliff:g id="network_name">%1$s</xliff:g> SIM</string>
+ <!-- Summary of the safety center issue when a connected network is not using encryption. -->
+ <string name="scNullCipherIssueNonEncryptedSummary">Calls, messages, and data are currently more vulnerable while using your <xliff:g id="network_name">%1$s</xliff:g> SIM.\n\nWhen your connection is encrypted again, you\'ll get another notification.</string>
+
<!-- Label for the button that links to the cellular network security settings. -->
- <string name="scNullCipherIssueActionSettings">Cellular security settings</string>
- <!-- Label for the button that link to education resourcess about cellular network security settings. -->
+ <string name="scNullCipherIssueActionSettings">Mobile network security settings</string>
+ <!-- Label for the button that links to education resourcess about cellular network security settings. -->
<string name="scNullCipherIssueActionLearnMore">Learn more</string>
+ <!-- Label for the button to acknowledge the user is connected to an encrypted network again in cellular network security settings. -->
+ <string name="scNullCipherIssueActionGotIt">Got it</string>
<!-- android.net.http Error strings --> <skip />
<!-- Displayed when a feature code (non-phone number) is dialed and completes successfully. -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index bf2bc26..90132c3 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -957,12 +957,15 @@
<java-symbol type="string" name="scCellularNetworkSecurityTitle" />
<java-symbol type="string" name="scCellularNetworkSecurityLearnMore" />
<java-symbol type="string" name="scIdentifierDisclosureIssueSummary" />
+ <java-symbol type="string" name="scIdentifierDisclosureIssueSummaryNotification" />
<java-symbol type="string" name="scIdentifierDisclosureIssueTitle" />
+ <java-symbol type="string" name="scNullCipherIssueActionGotIt" />
<java-symbol type="string" name="scNullCipherIssueActionLearnMore" />
<java-symbol type="string" name="scNullCipherIssueActionSettings" />
<java-symbol type="string" name="scNullCipherIssueEncryptedSummary" />
<java-symbol type="string" name="scNullCipherIssueEncryptedTitle" />
<java-symbol type="string" name="scNullCipherIssueNonEncryptedSummary" />
+ <java-symbol type="string" name="scNullCipherIssueNonEncryptedSummaryNotification" />
<java-symbol type="string" name="scNullCipherIssueNonEncryptedTitle" />
<java-symbol type="string" name="selected" />
<java-symbol type="string" name="sendText" />
@@ -5410,4 +5413,7 @@
<java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" />
<java-symbol type="integer" name="config_defaultMinEmergencyGestureTapDurationMillis" />
+ <!-- Back swipe thresholds -->
+ <java-symbol type="dimen" name="navigation_edge_action_progress_threshold" />
+ <java-symbol type="dimen" name="back_progress_non_linear_factor" />
</resources>
diff --git a/core/tests/coretests/src/android/view/ViewFrameRateTest.java b/core/tests/coretests/src/android/view/ViewFrameRateTest.java
index 4b9aaae..4cdc993 100644
--- a/core/tests/coretests/src/android/view/ViewFrameRateTest.java
+++ b/core/tests/coretests/src/android/view/ViewFrameRateTest.java
@@ -183,6 +183,7 @@
mActivityRule.runOnUiThread(() -> {
frameLayout.setFrameContentVelocity(1f);
mMovingView.offsetTopAndBottom(100);
+ frameLayout.invalidate();
runAfterDraw(() -> assertEquals(60f, mViewRoot.getLastPreferredFrameRate(), 0f));
});
waitForAfterDraw();
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/TouchTrackerTest.kt b/core/tests/coretests/src/android/window/BackTouchTrackerTest.kt
similarity index 96%
rename from libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/TouchTrackerTest.kt
rename to core/tests/coretests/src/android/window/BackTouchTrackerTest.kt
index 6dbb1e2..b7bccd4 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/TouchTrackerTest.kt
+++ b/core/tests/coretests/src/android/window/BackTouchTrackerTest.kt
@@ -13,23 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.wm.shell.back
+package android.window
import android.util.MathUtils
-import android.window.BackEvent
import org.junit.Assert.assertEquals
import org.junit.Test
-class TouchTrackerTest {
- private fun linearTouchTracker(): TouchTracker = TouchTracker().apply {
+class BackTouchTrackerTest {
+ private fun linearTouchTracker(): BackTouchTracker = BackTouchTracker().apply {
setProgressThresholds(MAX_DISTANCE, MAX_DISTANCE, NON_LINEAR_FACTOR)
}
- private fun nonLinearTouchTracker(): TouchTracker = TouchTracker().apply {
+ private fun nonLinearTouchTracker(): BackTouchTracker = BackTouchTracker().apply {
setProgressThresholds(LINEAR_DISTANCE, MAX_DISTANCE, NON_LINEAR_FACTOR)
}
- private fun TouchTracker.assertProgress(expected: Float) {
+ private fun BackTouchTracker.assertProgress(expected: Float) {
val actualProgress = createProgressEvent().progress
assertEquals(expected, actualProgress, /* delta = */ 0f)
}
@@ -243,4 +242,4 @@
private const val INITIAL_X_LEFT_EDGE = 5f
private const val INITIAL_X_RIGHT_EDGE = MAX_DISTANCE - INITIAL_X_LEFT_EDGE
}
-}
\ No newline at end of file
+}
diff --git a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java
index 6321e5d..36bede9 100644
--- a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java
+++ b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java
@@ -20,6 +20,8 @@
import static android.window.OnBackInvokedDispatcher.PRIORITY_OVERLAY;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.atLeast;
@@ -32,10 +34,12 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import android.os.Looper;
import android.os.RemoteException;
import android.platform.test.annotations.Presubmit;
import android.view.IWindow;
import android.view.IWindowSession;
+import android.view.MotionEvent;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -87,6 +91,8 @@
/* triggerBack = */ false,
/* swipeEdge = */ BackEvent.EDGE_LEFT,
/* departingAnimationTarget = */ null);
+ private final MotionEvent mMotionEvent =
+ MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 100, 100, 0);
@Before
public void setUp() throws Exception {
@@ -95,7 +101,7 @@
doReturn(true).when(mApplicationInfo).isOnBackInvokedCallbackEnabled();
doReturn(mApplicationInfo).when(mContext).getApplicationInfo();
- mDispatcher = new WindowOnBackInvokedDispatcher(mContext);
+ mDispatcher = new WindowOnBackInvokedDispatcher(mContext, Looper.getMainLooper());
mDispatcher.attachToWindow(mWindowSession, mWindow, null);
}
@@ -377,4 +383,36 @@
verify(mCallback1, never()).onBackInvoked();
verify(mCallback1).onBackCancelled();
}
+
+ @Test
+ public void updatesDispatchingState() throws RemoteException {
+ mDispatcher.registerOnBackInvokedCallback(PRIORITY_DEFAULT, mCallback1);
+ OnBackInvokedCallbackInfo callbackInfo = assertSetCallbackInfo();
+
+ callbackInfo.getCallback().onBackStarted(mBackEvent);
+ waitForIdle();
+ assertTrue(mDispatcher.isDispatching());
+
+ callbackInfo.getCallback().onBackInvoked();
+ waitForIdle();
+ assertFalse(mDispatcher.isDispatching());
+ }
+
+ @Test
+ public void handlesMotionEvent() throws RemoteException {
+ mDispatcher.registerOnBackInvokedCallback(PRIORITY_DEFAULT, mCallback1);
+ OnBackInvokedCallbackInfo callbackInfo = assertSetCallbackInfo();
+
+ mDispatcher.onMotionEvent(mMotionEvent);
+ assertFalse(mDispatcher.mTouchTracker.isActive());
+
+ callbackInfo.getCallback().onBackStarted(mBackEvent);
+ waitForIdle();
+ assertTrue(mDispatcher.isDispatching());
+ assertTrue(mDispatcher.mTouchTracker.isActive());
+
+ mDispatcher.onMotionEvent(mMotionEvent);
+ waitForIdle();
+ verify(mCallback1).onBackProgressed(any());
+ }
}
diff --git a/graphics/java/android/framework_graphics.aconfig b/graphics/java/android/framework_graphics.aconfig
index 4ab09eb..0b9e72d 100644
--- a/graphics/java/android/framework_graphics.aconfig
+++ b/graphics/java/android/framework_graphics.aconfig
@@ -16,3 +16,11 @@
description: "Feature flag for YUV image compress to Ultra HDR."
bug: "308978825"
}
+
+flag {
+ name: "icon_load_drawable_return_null_when_uri_decode_fails"
+ is_exported: true
+ namespace: "core_graphics"
+ description: "Return null when decode from URI fails in Icon.loadDrawable()"
+ bug: "335878768"
+}
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index b291f93..579ac60 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -43,6 +43,7 @@
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.LayoutDirection;
+import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
@@ -138,6 +139,9 @@
*/
@Deprecated
public BitmapDrawable(Bitmap bitmap) {
+ if (bitmap == null) {
+ Log.w(TAG, "BitmapDrawable created with null Bitmap");
+ }
init(new BitmapState(bitmap), null);
}
@@ -146,6 +150,9 @@
* the display metrics of the resources.
*/
public BitmapDrawable(Resources res, Bitmap bitmap) {
+ if (bitmap == null) {
+ Log.w(TAG, "BitmapDrawable created with null Bitmap");
+ }
init(new BitmapState(bitmap), res);
}
@@ -177,7 +184,7 @@
} finally {
init(new BitmapState(bitmap), res);
if (mBitmapState.mBitmap == null) {
- android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
+ Log.w(TAG, "BitmapDrawable cannot decode " + filepath);
}
}
}
@@ -210,7 +217,7 @@
} finally {
init(new BitmapState(bitmap), res);
if (mBitmapState.mBitmap == null) {
- android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + is);
+ Log.w(TAG, "BitmapDrawable cannot decode " + is);
}
}
}
@@ -1073,4 +1080,6 @@
mBitmapState.mBlendMode);
computeBitmapSize();
}
+
+ private static final String TAG = "BitmapDrawable";
}
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index f359025..ed15258 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -494,15 +494,22 @@
case TYPE_URI:
InputStream is = getUriInputStream(context);
if (is != null) {
- return new BitmapDrawable(context.getResources(),
- fixMaxBitmapSize(BitmapFactory.decodeStream(is)));
+ final Bitmap bitmap = BitmapFactory.decodeStream(is);
+ if (bitmap == null) {
+ Log.w(TAG, "Unable to decode image from URI: " + getUriString());
+ }
+ return new BitmapDrawable(context.getResources(), fixMaxBitmapSize(bitmap));
}
break;
case TYPE_URI_ADAPTIVE_BITMAP:
is = getUriInputStream(context);
if (is != null) {
+ final Bitmap bitmap = BitmapFactory.decodeStream(is);
+ if (bitmap == null) {
+ Log.w(TAG, "Unable to decode image from URI: " + getUriString());
+ }
return new AdaptiveIconDrawable(null, new BitmapDrawable(context.getResources(),
- fixMaxBitmapSize(BitmapFactory.decodeStream(is))));
+ fixMaxBitmapSize(bitmap)));
}
break;
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimation.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimation.java
index 2643211..196f89d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimation.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimation.java
@@ -49,9 +49,9 @@
@BackEvent.SwipeEdge int swipeEdge);
/**
- * Called when the input pointers are pilfered.
+ * Called when the back swipe threshold is crossed.
*/
- void onPilferPointers();
+ void onThresholdCrossed();
/**
* Sets whether the back gesture is past the trigger threshold or not.
@@ -101,4 +101,10 @@
* @param customizer the controller to control system bar color.
*/
void setStatusBarCustomizer(StatusBarCustomizer customizer);
+
+ /**
+ * Set a callback to pilfer pointers.
+ * @param pilferCallback the callback to pilfer pointers.
+ */
+ void setPilferPointerCallback(Runnable pilferCallback);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
index d3fe4f8..163a896 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
@@ -22,9 +22,6 @@
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BACK_PREVIEW;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
@@ -46,7 +43,6 @@
import android.provider.Settings.Global;
import android.util.DisplayMetrics;
import android.util.Log;
-import android.util.MathUtils;
import android.view.IRemoteAnimationRunner;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
@@ -57,6 +53,7 @@
import android.window.BackEvent;
import android.window.BackMotionEvent;
import android.window.BackNavigationInfo;
+import android.window.BackTouchTracker;
import android.window.IBackAnimationFinishedCallback;
import android.window.IBackAnimationRunner;
import android.window.IOnBackInvokedCallback;
@@ -118,7 +115,8 @@
/** Tracks if we should start the back gesture on the next motion move event */
private boolean mShouldStartOnNextMoveEvent = false;
private boolean mOnBackStartDispatched = false;
- private boolean mPointerPilfered = false;
+ private boolean mThresholdCrossed = false;
+ private boolean mPointersPilfered = false;
private final boolean mRequirePointerPilfer;
private final FlingAnimationUtils mFlingAnimationUtils;
@@ -139,13 +137,13 @@
/**
* Tracks the current user back gesture.
*/
- private TouchTracker mCurrentTracker = new TouchTracker();
+ private BackTouchTracker mCurrentTracker = new BackTouchTracker();
/**
* Tracks the next back gesture in case a new user gesture has started while the back animation
* (and navigation) associated with {@link #mCurrentTracker} have not yet finished.
*/
- private TouchTracker mQueuedTracker = new TouchTracker();
+ private BackTouchTracker mQueuedTracker = new BackTouchTracker();
private final Runnable mAnimationTimeoutRunnable = () -> {
ProtoLog.w(WM_SHELL_BACK_PREVIEW, "Animation didn't finish in %d ms. Resetting...",
@@ -189,6 +187,7 @@
// Keep previous navigation type before remove mBackNavigationInfo.
@BackNavigationInfo.BackTargetType
private int mPreviousNavigationType;
+ private Runnable mPilferPointerCallback;
public BackAnimationController(
@NonNull ShellInit shellInit,
@@ -335,8 +334,8 @@
}
@Override
- public void onPilferPointers() {
- BackAnimationController.this.onPilferPointers();
+ public void onThresholdCrossed() {
+ BackAnimationController.this.onThresholdCrossed();
}
@Override
@@ -358,6 +357,13 @@
mCustomizer = customizer;
mAnimationBackground.setStatusBarCustomizer(customizer);
}
+
+ @Override
+ public void setPilferPointerCallback(Runnable callback) {
+ mShellExecutor.execute(() -> {
+ mPilferPointerCallback = callback;
+ });
+ }
}
private static class IBackAnimationImpl extends IBackAnimation.Stub
@@ -414,20 +420,23 @@
mShellBackAnimationRegistry.unregisterAnimation(type);
}
- private TouchTracker getActiveTracker() {
+ private BackTouchTracker getActiveTracker() {
if (mCurrentTracker.isActive()) return mCurrentTracker;
if (mQueuedTracker.isActive()) return mQueuedTracker;
return null;
}
@VisibleForTesting
- void onPilferPointers() {
- mPointerPilfered = true;
+ public void onThresholdCrossed() {
+ mThresholdCrossed = true;
// Dispatch onBackStarted, only to app callbacks.
// System callbacks will receive onBackStarted when the remote animation starts.
- if (!shouldDispatchToAnimator() && mActiveCallback != null) {
+ final boolean shouldDispatchToAnimator = shouldDispatchToAnimator();
+ if (!shouldDispatchToAnimator && mActiveCallback != null) {
mCurrentTracker.updateStartLocation();
tryDispatchOnBackStarted(mActiveCallback, mCurrentTracker.createStartEvent(null));
+ } else if (shouldDispatchToAnimator) {
+ tryPilferPointers();
}
}
@@ -443,7 +452,7 @@
int keyAction,
@BackEvent.SwipeEdge int swipeEdge) {
- TouchTracker activeTouchTracker = getActiveTracker();
+ BackTouchTracker activeTouchTracker = getActiveTracker();
if (activeTouchTracker != null) {
activeTouchTracker.update(touchX, touchY, velocityX, velocityY);
}
@@ -487,7 +496,7 @@
// onBackCancelled event, let's interrupt it and start animating a new back gesture
resetTouchTracker();
}
- TouchTracker touchTracker;
+ BackTouchTracker touchTracker;
if (mCurrentTracker.isInInitialState()) {
touchTracker = mCurrentTracker;
} else if (mQueuedTracker.isInInitialState()) {
@@ -498,7 +507,7 @@
return;
}
touchTracker.setGestureStartLocation(touchX, touchY, swipeEdge);
- touchTracker.setState(TouchTracker.TouchTrackerState.ACTIVE);
+ touchTracker.setState(BackTouchTracker.TouchTrackerState.ACTIVE);
mBackGestureStarted = true;
if (interruptCancelPostCommitAnimation) {
@@ -514,7 +523,7 @@
}
}
- private void startBackNavigation(@NonNull TouchTracker touchTracker) {
+ private void startBackNavigation(@NonNull BackTouchTracker touchTracker) {
try {
startLatencyTracking();
mBackNavigationInfo = mActivityTaskManager.startBackNavigation(
@@ -527,7 +536,7 @@
}
private void onBackNavigationInfoReceived(@Nullable BackNavigationInfo backNavigationInfo,
- @NonNull TouchTracker touchTracker) {
+ @NonNull BackTouchTracker touchTracker) {
ProtoLog.d(WM_SHELL_BACK_PREVIEW, "Received backNavigationInfo:%s", backNavigationInfo);
if (backNavigationInfo == null) {
ProtoLog.e(WM_SHELL_BACK_PREVIEW, "Received BackNavigationInfo is null.");
@@ -540,6 +549,7 @@
if (!mShellBackAnimationRegistry.startGesture(backType)) {
mActiveCallback = null;
}
+ tryPilferPointers();
} else {
mActiveCallback = mBackNavigationInfo.getOnBackInvokedCallback();
// App is handling back animation. Cancel system animation latency tracking.
@@ -588,12 +598,22 @@
&& mBackNavigationInfo.isPrepareRemoteAnimation();
}
+ private void tryPilferPointers() {
+ if (mPointersPilfered || !mThresholdCrossed) {
+ return;
+ }
+ if (mPilferPointerCallback != null) {
+ mPilferPointerCallback.run();
+ }
+ mPointersPilfered = true;
+ }
+
private void tryDispatchOnBackStarted(
IOnBackInvokedCallback callback,
BackMotionEvent backEvent) {
if (mOnBackStartDispatched
|| callback == null
- || (!mPointerPilfered && mRequirePointerPilfer)) {
+ || (!mThresholdCrossed && mRequirePointerPilfer)) {
return;
}
dispatchOnBackStarted(callback, backEvent);
@@ -613,79 +633,6 @@
}
}
-
- /**
- * Allows us to manage the fling gesture, it smoothly animates the current progress value to
- * the final position, calculated based on the current velocity.
- *
- * @param callback the callback to be invoked when the animation ends.
- */
- private void dispatchOrAnimateOnBackInvoked(IOnBackInvokedCallback callback,
- @NonNull TouchTracker touchTracker) {
- if (callback == null) {
- return;
- }
-
- boolean animationStarted = false;
-
- if (mBackNavigationInfo != null && mBackNavigationInfo.isAnimationCallback()) {
-
- final BackMotionEvent backMotionEvent = touchTracker.createProgressEvent();
- if (backMotionEvent != null) {
- // Constraints - absolute values
- float minVelocity = mFlingAnimationUtils.getMinVelocityPxPerSecond();
- float maxVelocity = mFlingAnimationUtils.getHighVelocityPxPerSecond();
- float maxX = touchTracker.getMaxDistance(); // px
- float maxFlingDistance = maxX * MAX_FLING_PROGRESS; // px
-
- // Current state
- float currentX = backMotionEvent.getTouchX();
- float velocity = MathUtils.constrain(backMotionEvent.getVelocityX(),
- -maxVelocity, maxVelocity);
-
- // Target state
- float animationFaction = velocity / maxVelocity; // value between -1 and 1
- float flingDistance = animationFaction * maxFlingDistance; // px
- float endX = MathUtils.constrain(currentX + flingDistance, 0f, maxX);
-
- if (!Float.isNaN(endX)
- && currentX != endX
- && Math.abs(velocity) >= minVelocity) {
- ValueAnimator animator = ValueAnimator.ofFloat(currentX, endX);
-
- mFlingAnimationUtils.apply(
- /* animator = */ animator,
- /* currValue = */ currentX,
- /* endValue = */ endX,
- /* velocity = */ velocity,
- /* maxDistance = */ maxFlingDistance
- );
-
- animator.addUpdateListener(animation -> {
- Float animatedValue = (Float) animation.getAnimatedValue();
- float progress = touchTracker.getProgress(animatedValue);
- final BackMotionEvent backEvent = touchTracker.createProgressEvent(
- progress);
- dispatchOnBackProgressed(mActiveCallback, backEvent);
- });
-
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- dispatchOnBackInvoked(callback);
- }
- });
- animator.start();
- animationStarted = true;
- }
- }
- }
-
- if (!animationStarted) {
- dispatchOnBackInvoked(callback);
- }
- }
-
private void dispatchOnBackInvoked(IOnBackInvokedCallback callback) {
if (callback == null) {
return;
@@ -714,7 +661,7 @@
private void dispatchOnBackProgressed(IOnBackInvokedCallback callback,
BackMotionEvent backEvent) {
- if (callback == null) {
+ if (callback == null || !shouldDispatchToAnimator()) {
return;
}
try {
@@ -728,7 +675,14 @@
* Sets to true when the back gesture has passed the triggering threshold, false otherwise.
*/
public void setTriggerBack(boolean triggerBack) {
- TouchTracker activeBackGestureInfo = getActiveTracker();
+ if (mActiveCallback != null) {
+ try {
+ mActiveCallback.setTriggerBack(triggerBack);
+ } catch (RemoteException e) {
+ Log.e(TAG, "remote setTriggerBack error: ", e);
+ }
+ }
+ BackTouchTracker activeBackGestureInfo = getActiveTracker();
if (activeBackGestureInfo != null) {
activeBackGestureInfo.setTriggerBack(triggerBack);
}
@@ -742,7 +696,7 @@
mQueuedTracker.setProgressThresholds(linearDistance, maxDistance, nonLinearFactor);
}
- private void invokeOrCancelBack(@NonNull TouchTracker touchTracker) {
+ private void invokeOrCancelBack(@NonNull BackTouchTracker touchTracker) {
// Make a synchronized call to core before dispatch back event to client side.
// If the close transition happens before the core receives onAnimationFinished, there will
// play a second close animation for that transition.
@@ -758,7 +712,7 @@
if (mBackNavigationInfo != null) {
final IOnBackInvokedCallback callback = mBackNavigationInfo.getOnBackInvokedCallback();
if (touchTracker.getTriggerBack()) {
- dispatchOrAnimateOnBackInvoked(callback, touchTracker);
+ dispatchOnBackInvoked(callback);
} else {
tryDispatchOnBackCancelled(callback);
}
@@ -770,7 +724,7 @@
* Called when the gesture is released, then it could start the post commit animation.
*/
private void onGestureFinished() {
- TouchTracker activeTouchTracker = getActiveTracker();
+ BackTouchTracker activeTouchTracker = getActiveTracker();
if (!mBackGestureStarted || activeTouchTracker == null) {
// This can happen when an unfinished gesture has been reset in resetTouchTracker
ProtoLog.d(WM_SHELL_BACK_PREVIEW,
@@ -780,8 +734,11 @@
boolean triggerBack = activeTouchTracker.getTriggerBack();
ProtoLog.d(WM_SHELL_BACK_PREVIEW, "onGestureFinished() mTriggerBack == %s", triggerBack);
+ // Reset gesture states.
+ mThresholdCrossed = false;
+ mPointersPilfered = false;
mBackGestureStarted = false;
- activeTouchTracker.setState(TouchTracker.TouchTrackerState.FINISHED);
+ activeTouchTracker.setState(BackTouchTracker.TouchTrackerState.FINISHED);
if (mPostCommitAnimationInProgress) {
ProtoLog.w(WM_SHELL_BACK_PREVIEW, "Animation is still running");
@@ -839,7 +796,7 @@
if (mCurrentTracker.getTriggerBack()) {
// notify gesture finished
mBackNavigationInfo.onBackGestureFinished(true);
- dispatchOrAnimateOnBackInvoked(mActiveCallback, mCurrentTracker);
+ dispatchOnBackInvoked(mActiveCallback);
} else {
tryDispatchOnBackCancelled(mActiveCallback);
}
@@ -882,10 +839,11 @@
}
/**
- * Resets the TouchTracker and potentially starts a new back navigation in case one is queued
+ * Resets the BackTouchTracker and potentially starts a new back navigation in case one
+ * is queued.
*/
private void resetTouchTracker() {
- TouchTracker temp = mCurrentTracker;
+ BackTouchTracker temp = mCurrentTracker;
mCurrentTracker = mQueuedTracker;
temp.reset();
mQueuedTracker = temp;
@@ -928,7 +886,8 @@
mApps = null;
mShouldStartOnNextMoveEvent = false;
mOnBackStartDispatched = false;
- mPointerPilfered = false;
+ mThresholdCrossed = false;
+ mPointersPilfered = false;
mShellBackAnimationRegistry.resetDefaultCrossActivity();
cancelLatencyTracking();
if (mBackNavigationInfo != null) {
@@ -1076,7 +1035,7 @@
pw.println(prefix + " mBackGestureStarted=" + mBackGestureStarted);
pw.println(prefix + " mPostCommitAnimationInProgress=" + mPostCommitAnimationInProgress);
pw.println(prefix + " mShouldStartOnNextMoveEvent=" + mShouldStartOnNextMoveEvent);
- pw.println(prefix + " mPointerPilfered=" + mPointerPilfered);
+ pw.println(prefix + " mPointerPilfered=" + mThresholdCrossed);
pw.println(prefix + " mRequirePointerPilfer=" + mRequirePointerPilfer);
pw.println(prefix + " mCurrentTracker state:");
mCurrentTracker.dump(pw, prefix + " ");
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
index 65169e3..f99b4b2 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java
@@ -354,6 +354,7 @@
// Verify that we prevent any interaction with the animator callback in case a new gesture
// starts while the current back animation has not ended, instead the gesture is queued
triggerBackGesture();
+ verify(mAnimatorCallback).setTriggerBack(eq(true));
verifyNoMoreInteractions(mAnimatorCallback);
// Finish previous back navigation.
@@ -394,6 +395,7 @@
// starts while the current back animation has not ended, instead the gesture is queued
triggerBackGesture();
releaseBackGesture();
+ verify(mAnimatorCallback).setTriggerBack(eq(true));
verifyNoMoreInteractions(mAnimatorCallback);
// Finish previous back navigation.
@@ -532,7 +534,7 @@
}
@Test
- public void callbackShouldDeliverProgress() throws RemoteException {
+ public void appCallback_receivesStartAndInvoke() throws RemoteException {
registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME);
final int type = BackNavigationInfo.TYPE_CALLBACK;
@@ -551,8 +553,9 @@
assertTrue("TriggerBack should have been true", result.mTriggerBack);
verify(mAppCallback, times(1)).onBackStarted(any());
- verify(mAppCallback, times(1)).onBackProgressed(any());
verify(mAppCallback, times(1)).onBackInvoked();
+ // Progress events should be generated from the app process.
+ verify(mAppCallback, never()).onBackProgressed(any());
verify(mAnimatorCallback, never()).onBackStarted(any());
verify(mAnimatorCallback, never()).onBackProgressed(any());
@@ -639,7 +642,7 @@
*/
private void doStartEvents(int startX, int moveX) {
doMotionEvent(MotionEvent.ACTION_DOWN, startX);
- mController.onPilferPointers();
+ mController.onThresholdCrossed();
doMotionEvent(MotionEvent.ACTION_MOVE, moveX);
}
diff --git a/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
index 5b2fa1d..05507e0 100644
--- a/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
+++ b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
@@ -17,10 +17,15 @@
package com.android.settingslib.widget;
import android.content.Context;
+import android.content.Intent;
import android.text.SpannableString;
+import android.text.Spanned;
import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -32,18 +37,20 @@
import com.android.settingslib.widget.preference.footer.R;
+import java.net.URISyntaxException;
+
/**
* A custom preference acting as "footer" of a page. It has a field for icon and text. It is added
* to screen as the last preference.
*/
public class FooterPreference extends Preference {
+ private static final String TAG = "FooterPreference";
public static final String KEY_FOOTER = "footer_preference";
+ private static final String INTENT_URL_PREFIX = "intent:";
static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
- @VisibleForTesting
- View.OnClickListener mLearnMoreListener;
- @VisibleForTesting
- int mIconVisibility = View.VISIBLE;
+ @VisibleForTesting View.OnClickListener mLearnMoreListener;
+ @VisibleForTesting int mIconVisibility = View.VISIBLE;
private CharSequence mContentDescription;
private CharSequence mLearnMoreText;
private FooterLearnMoreSpan mLearnMoreSpan;
@@ -57,12 +64,56 @@
this(context, null);
}
+ private void linkifyTitle(TextView title) {
+ final CharSequence text = getTitle();
+ if (!(text instanceof Spanned)) {
+ return;
+ }
+ final ClickableSpan[] spans =
+ ((Spanned) text).getSpans(0, text.length(), ClickableSpan.class);
+ if (spans.length == 0) {
+ return;
+ }
+ SpannableString spannable = new SpannableString(text);
+ for (ClickableSpan clickable : spans) {
+ if (!(clickable instanceof URLSpan)) {
+ continue;
+ }
+ final URLSpan urlSpan = (URLSpan) clickable;
+ if (!urlSpan.getURL().startsWith(INTENT_URL_PREFIX)) {
+ continue;
+ }
+ final int start = spannable.getSpanStart(urlSpan);
+ final int end = spannable.getSpanEnd(urlSpan);
+ spannable.removeSpan(urlSpan);
+ try {
+ final Intent intent = Intent.parseUri(urlSpan.getURL(), Intent.URI_INTENT_SCHEME);
+ final ClickableSpan clickableSpan =
+ new ClickableSpan() {
+ @Override
+ public void onClick(@NonNull View textView) {
+ // May throw ActivityNotFoundException. Just let it propagate.
+ getContext().startActivity(intent);
+ }
+ };
+ spannable.setSpan(clickableSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ } catch (URISyntaxException e) {
+ Log.e(TAG, "Invalid URI " + urlSpan.getURL(), e);
+ }
+ }
+ title.setText(spannable);
+ title.setMovementMethod(LinkMovementMethod.getInstance());
+ }
+
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView title = holder.itemView.findViewById(android.R.id.title);
- if (title != null && !TextUtils.isEmpty(mContentDescription)) {
- title.setContentDescription(mContentDescription);
+ if (title != null) {
+ if (!TextUtils.isEmpty(mContentDescription)) {
+ title.setContentDescription(mContentDescription);
+ }
+ linkifyTitle(title);
}
TextView learnMore = holder.itemView.findViewById(R.id.settingslib_learn_more);
@@ -79,8 +130,7 @@
learnMoreText.removeSpan(mLearnMoreSpan);
}
mLearnMoreSpan = new FooterLearnMoreSpan(mLearnMoreListener);
- learnMoreText.setSpan(mLearnMoreSpan, 0,
- learnMoreText.length(), 0);
+ learnMoreText.setSpan(mLearnMoreSpan, 0, learnMoreText.length(), 0);
learnMore.setText(learnMoreText);
} else {
learnMore.setVisibility(View.GONE);
@@ -121,9 +171,7 @@
}
}
- /**
- * Return the content description of footer preference.
- */
+ /** Return the content description of footer preference. */
@VisibleForTesting
CharSequence getContentDescription() {
return mContentDescription;
@@ -141,9 +189,7 @@
}
}
- /**
- * Assign an action for the learn more link.
- */
+ /** Assign an action for the learn more link. */
public void setLearnMoreAction(View.OnClickListener listener) {
if (mLearnMoreListener != listener) {
mLearnMoreListener = listener;
@@ -151,9 +197,7 @@
}
}
- /**
- * Set visibility of footer icon.
- */
+ /** Set visibility of footer icon. */
public void setIconVisibility(int iconVisibility) {
if (mIconVisibility == iconVisibility) {
return;
@@ -174,9 +218,7 @@
setSelectable(false);
}
- /**
- * The builder is convenient to creat a dynamic FooterPreference.
- */
+ /** The builder is convenient to creat a dynamic FooterPreference. */
public static class Builder {
private Context mContext;
private String mKey;
@@ -241,8 +283,8 @@
}
/**
- * To set learn more string of the learn more text. This can use for talkback
- * environment if developer wants to have a customization content.
+ * To set learn more string of the learn more text. This can use for talkback environment if
+ * developer wants to have a customization content.
*
* @param learnMoreText The resource id of the learn more string.
*/
@@ -262,10 +304,7 @@
return this;
}
-
- /**
- * To generate the {@link FooterPreference}.
- */
+ /** To generate the {@link FooterPreference}. */
public FooterPreference build() {
final FooterPreference footerPreference = new FooterPreference(mContext);
footerPreference.setSelectable(false);
@@ -288,9 +327,7 @@
}
}
- /**
- * A {@link URLSpan} that opens a support page when clicked
- */
+ /** A {@link URLSpan} that opens a support page when clicked */
static class FooterLearnMoreSpan extends URLSpan {
private final View.OnClickListener mClickListener;
diff --git a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffect.kt b/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffect.kt
deleted file mode 100644
index c08afd3..0000000
--- a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffect.kt
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.surfaceeffects.gloweffect
-
-import android.animation.ValueAnimator
-import android.animation.ValueAnimator.INFINITE
-import android.graphics.RenderEffect
-import androidx.annotation.VisibleForTesting
-import com.android.systemui.surfaceeffects.RenderEffectDrawCallback
-import com.android.systemui.surfaceeffects.utils.MathUtils
-
-/** Renders rotating pie with glow on top, masked with a rounded box. */
-class GlowPieEffect(
- config: GlowPieEffectConfig,
- private val renderEffectDrawCallback: RenderEffectDrawCallback
-) {
-
- private val glowPieShader = GlowPieShader().apply { applyConfig(config) }
-
- @VisibleForTesting
- val mainAnimator: ValueAnimator =
- ValueAnimator.ofFloat(0f, 1f).apply {
- // We want to loop the full cycle.
- duration = DURATION_MS
- repeatMode = ValueAnimator.RESTART
- repeatCount = INFINITE
- }
-
- /** Plays glow pie until [finish] is called. */
- fun play() {
- if (mainAnimator.isRunning) return
-
- baseGlow.resetProgress()
- firstGlowPie.resetProgress()
- secondGlowPie.resetProgress()
-
- mainAnimator.addUpdateListener { updateListener ->
- val time = updateListener.currentPlayTime.toFloat() % mainAnimator.duration
-
- // Remap each glow pie progress.
- baseGlow.updateProgress(time)
- firstGlowPie.updateProgress(time)
- secondGlowPie.updateProgress(time)
-
- // TODO(b/335315940): Consider passing in 2D Matrix.
- glowPieShader.setAngles(baseGlow.angle(), firstGlowPie.angle(), secondGlowPie.angle())
- glowPieShader.setBottomAngleThresholds(
- baseGlow.bottomThreshold(),
- firstGlowPie.bottomThreshold(),
- secondGlowPie.bottomThreshold()
- )
- glowPieShader.setTopAngleThresholds(
- baseGlow.topThreshold(),
- firstGlowPie.topThreshold(),
- secondGlowPie.topThreshold()
- )
- glowPieShader.setAlphas(baseGlow.alpha(), firstGlowPie.alpha(), secondGlowPie.alpha())
-
- // Finally trigger the draw callback.
- renderEffectDrawCallback.onDraw(
- RenderEffect.createRuntimeShaderEffect(
- glowPieShader,
- GlowPieShader.BACKGROUND_UNIFORM
- )
- )
- }
-
- mainAnimator.start()
- }
-
- fun finish() {
- // TODO(b/335315940) Add alpha fade.
- mainAnimator.cancel()
- }
-
- companion object {
- @VisibleForTesting const val PI = Math.PI.toFloat()
- @VisibleForTesting const val FEATHER = 0.3f
- @VisibleForTesting const val DURATION_MS = 3000L
-
- private val baseGlow = BaseGlow()
- private val firstGlowPie = FirstGlowPie()
- private val secondGlowPie = SecondGlowPie()
- }
-
- /** Contains animation parameters for each layer of glow pie. */
- interface GlowPie {
- /**
- * The start & end timestamps of the animation. Must be smaller than or equal to the full
- * [DURATION_MS].
- */
- val startMs: Float
- val endMs: Float
- /**
- * Start & end angles in radian. This determines how many cycles you want to rotate. e.g.
- * startAngle = 0f endAngle = 4f * PI, will give you the 2 cycles.
- */
- val startAngle: Float
- val endAngle: Float
- /**
- * Start & end timestamps of the fade out duration. You may want to override [alpha] if you
- * want to make it fade in. See [BaseGlow].
- */
- val alphaFadeStartMs: Float
- val alphaFadeEndMs: Float
-
- /** Below two values are expected to be updated through [updateProgress]. */
- /** Normalized progress. */
- var progress: Float
- /** current time of the animation in ms. */
- var time: Float
-
- // Must be called before retrieving angle, bottom & top thresholds, and alpha.
- // Otherwise the values would be stale.
- fun updateProgress(time: Float) {
- progress = MathUtils.constrainedMap(0f, 1f, startMs, endMs, time)
- this.time = time
- }
-
- fun resetProgress() {
- progress = 0f
- time = 0f
- }
-
- fun angle(): Float {
- // Negate the angle since we want clock-wise rotation.
- val angle =
- MathUtils.constrainedMap(startAngle, endAngle, 0f, 1f, progress) + progress * PI
- return -angle
- }
-
- fun bottomThreshold(): Float {
- return MathUtils.lerp(1f, -FEATHER, progress)
- }
-
- fun topThreshold(): Float {
- return MathUtils.lerp(1f + FEATHER, 0f, progress)
- }
-
- // By default, it fades "out".
- fun alpha(): Float {
- // Remap timestamps (in MS) to alpha [0, 1].
- return MathUtils.constrainedMap(1f, 0f, alphaFadeStartMs, alphaFadeEndMs, time)
- }
- }
-
- data class BaseGlow(
- override val startMs: Float = 0f,
- override val endMs: Float = 0f,
- override val startAngle: Float = 0f,
- override val endAngle: Float = 0f,
- override val alphaFadeStartMs: Float = 2250f,
- override val alphaFadeEndMs: Float = 2950f,
- ) : GlowPie {
-
- override var progress: Float = 1f
- override var time: Float = 0f
- override fun updateProgress(time: Float) {}
-
- override fun resetProgress() {}
-
- override fun angle(): Float = 0f
-
- override fun bottomThreshold(): Float = 0f
-
- override fun topThreshold(): Float = 0f
-
- // Base glow fade "in" (i.e. reveals).
- override fun alpha(): Float {
- return MathUtils.constrainedMap(0f, 1f, alphaFadeStartMs, alphaFadeEndMs, time)
- }
- }
-
- data class FirstGlowPie(
- override val startMs: Float = 250f,
- override val endMs: Float = 2500f,
- override val startAngle: Float = -PI / 2f,
- override val endAngle: Float = 4f * PI,
- override val alphaFadeStartMs: Float = 2500f,
- override val alphaFadeEndMs: Float = 2750f,
- override var progress: Float = 0f,
- override var time: Float = 0f
- ) : GlowPie
-
- data class SecondGlowPie(
- override val startMs: Float = 350f,
- override val endMs: Float = 2600f,
- override val startAngle: Float = -PI / 2f,
- override val endAngle: Float = 3f * PI,
- override val alphaFadeStartMs: Float = 2600f,
- override val alphaFadeEndMs: Float = 2850f,
- override var progress: Float = 0f,
- override var time: Float = 0f
- ) : GlowPie
-}
diff --git a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectConfig.kt b/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectConfig.kt
deleted file mode 100644
index 6c728c1..0000000
--- a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectConfig.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.surfaceeffects.gloweffect
-
-/** Parameter values needed to draw [GlowPieEffect]. */
-data class GlowPieEffectConfig(
- /** Center x position of the effect. */
- val centerX: Float,
- /** Center y position of the effect. */
- val centerY: Float,
- /** Width of the rounded box mask. */
- val width: Float,
- /** Height of the rounded box mask. */
- val height: Float,
- /** Corner radius of the rounded box mask. */
- val cornerRadius: Float,
- /**
- * Colors of the effect. The number must match 3, which is defined in [GlowPieShader.NUM_PIE].
- * Each color corresponds to baseColor (bottom), firstLayerColor, and secondLayerColor (top).
- */
- val colors: IntArray
-)
diff --git a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieShader.kt b/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieShader.kt
deleted file mode 100644
index 2dbc0b5..0000000
--- a/packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieShader.kt
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.surfaceeffects.gloweffect
-
-import android.graphics.RuntimeShader
-import android.util.Log
-import com.android.systemui.surfaceeffects.shaderutil.SdfShaderLibrary
-import com.android.systemui.surfaceeffects.shaderutil.ShaderUtilLibrary
-
-/** Draws two glowing pies rotating around the center of a rounded box on a base. */
-class GlowPieShader : RuntimeShader(GLOW_PIE_SHADER_COMP) {
- // language=AGSL
- companion object {
- const val BACKGROUND_UNIFORM = "in_dst"
- const val NUM_PIE = 3
-
- private const val UNIFORMS =
- """
- uniform shader ${BACKGROUND_UNIFORM};
- uniform vec2 in_center;
- uniform vec2 in_size;
- uniform half in_cornerRad;
- uniform float[${NUM_PIE}] in_angles;
- uniform float[${NUM_PIE}] in_alphas;
- uniform float[${NUM_PIE}] in_bottomThresholds;
- uniform float[${NUM_PIE}] in_topThresholds;
- layout(color) uniform vec4 in_colors0;
- layout(color) uniform vec4 in_colors1;
- layout(color) uniform vec4 in_colors2;
- """
-
- private const val GLOW_PIE_MAIN =
- """
- vec4 main(vec2 p) {
- vec4 pie = vec4(0.);
- vec4 glow = vec4(0.);
-
- vec2 c = p - in_center;
- half box = sdRoundedBox(c, in_size, in_cornerRad);
-
- // Base glow (drawn at the bottom)
- pieGlow(
- box,
- c,
- in_angles[0],
- in_colors0.rgb,
- /* pieAlpha= */ 1., // We always show the base color.
- /* glowAlpha= */ in_alphas[0],
- vec2(in_bottomThresholds[0], in_topThresholds[0]),
- pie,
- glow
- );
-
- // First pie
- pieGlow(
- box,
- c,
- in_angles[1],
- in_colors1.rgb,
- /* pieAlpha= */ in_alphas[1],
- /* glowAlpha= */ in_alphas[1],
- vec2(in_bottomThresholds[1], in_topThresholds[1]),
- pie,
- glow
- );
-
- // Second pie (drawn on top)
- pieGlow(
- box,
- c,
- in_angles[2],
- in_colors2.rgb,
- /* pieAlpha= */ in_alphas[2],
- /* glowAlpha= */ in_alphas[2],
- vec2(in_bottomThresholds[2], in_topThresholds[2]),
- pie,
- glow
- );
-
- return vec4(pie.rgb + glow.rgb * 0.3, pie.a);
- }
- """
-
- private const val REMAP =
- """
- float remap(float in_start, float in_end, float out_start, float out_end, float x) {
- x = (x - in_start) / (in_end - in_start);
- x = clamp(x, 0., 1.);
- return x * (out_end - out_start) + out_start;
- }
- """
-
- /**
- * This function draws a pie slice, an a glow on top. The glow also has the same pie shape
- * but with more blur and additive blending.
- */
- private const val GLOW_PIE =
- """
- void pieGlow(
- half box,
- vec2 c,
- half angle,
- vec3 color,
- half pieAlpha,
- half glowAlpha,
- vec2 angleThresholds,
- inout vec4 inout_pie,
- inout vec4 inout_glow) {
-
- // Apply angular rotation.
- half co = cos(angle), si = sin(angle);
- mat2 rotM = mat2(co, -si, si, co); // 2D rotation matrix
- c *= rotM;
-
- // We rotate based on the cosine value, since we want to avoid using inverse
- // trig function, which in this case is atan.
-
- // Dot product with vec2(1., 0.) and bring the range to [0,1].
- // Same as dot(normalize(c), vec2(1.,0) * 0.5 + 0.5
- half d = normalize(c).x * 0.5 + 0.5;
-
- // Those thresholds represents each end of the pie.
- float bottomThreshold = angleThresholds[0];
- float topThreshold = angleThresholds[1];
- float angleMask = remap(bottomThreshold, topThreshold, 0., 1., d);
-
- half boxMask = 1. - smoothstep(-0.02, 0.02, box);
- vec4 pie = vec4(color, 1.0) * angleMask * boxMask * pieAlpha;
-
- // We are drawing the same pie but with more blur.
- half glowMask = 1. - smoothstep(0., 0.6, box);
- // Glow outside only.
- glowMask = min(glowMask, smoothstep(-0.02, 0.02, box));
- // Apply some curve for the glow. (Can take out)
- glowMask *= glowMask * glowMask;
- // Glow mask should also be sliced with the angle mask.
- glowMask *= angleMask;
- vec4 glow = vec4(color, 1.0) * glowMask * glowAlpha;
-
- inout_pie = pie + inout_pie * (1. - pie.a);
- // Additive blending.
- inout_glow += glow;
- }
- """
-
- private const val GLOW_PIE_SHADER_COMP =
- ShaderUtilLibrary.SHADER_LIB +
- SdfShaderLibrary.SHADER_SDF_OPERATION_LIB +
- SdfShaderLibrary.ROUNDED_BOX_SDF +
- UNIFORMS +
- REMAP +
- GLOW_PIE +
- GLOW_PIE_MAIN
-
- private val TAG = GlowPieShader::class.java.simpleName
- }
-
- fun applyConfig(config: GlowPieEffectConfig) {
- setCenter(config.centerX, config.centerY)
- setSize(config.width, config.height)
- setCornerRadius(config.cornerRadius)
- setColor(config.colors)
- }
-
- fun setCenter(centerX: Float, centerY: Float) {
- setFloatUniform("in_center", centerX, centerY)
- }
-
- fun setSize(width: Float, height: Float) {
- setFloatUniform("in_size", width, height)
- }
-
- fun setCornerRadius(cornerRadius: Float) {
- setFloatUniform("in_cornerRad", cornerRadius)
- }
-
- /** Ignores alpha value, as fade in/out is handled within shader. */
- fun setColor(colors: IntArray) {
- if (colors.size != NUM_PIE) {
- Log.wtf(TAG, "The number of colors must be $NUM_PIE")
- return
- }
- setColorUniform("in_colors0", colors[0])
- setColorUniform("in_colors1", colors[1])
- setColorUniform("in_colors2", colors[2])
- }
-
- fun setAngles(vararg angles: Float) {
- if (angles.size != NUM_PIE) {
- Log.wtf(TAG, "The number of angles must be $NUM_PIE")
- return
- }
- setFloatUniform("in_angles", angles)
- }
-
- fun setAlphas(vararg alphas: Float) {
- if (alphas.size != NUM_PIE) {
- Log.wtf(TAG, "The number of angles must be $NUM_PIE")
- return
- }
- setFloatUniform("in_alphas", alphas)
- }
-
- fun setBottomAngleThresholds(vararg bottomThresholds: Float) {
- if (bottomThresholds.size != NUM_PIE) {
- Log.wtf(TAG, "The number of bottomThresholds must be $NUM_PIE")
- return
- }
- setFloatUniform("in_bottomThresholds", bottomThresholds)
- }
-
- fun setTopAngleThresholds(vararg topThresholds: Float) {
- if (topThresholds.size != NUM_PIE) {
- Log.wtf(TAG, "The number of topThresholds must be $NUM_PIE")
- return
- }
- setFloatUniform("in_topThresholds", topThresholds)
- }
-}
diff --git a/packages/SystemUI/monet/src/com/android/systemui/monet/Shades.java b/packages/SystemUI/monet/src/com/android/systemui/monet/Shades.java
index c97b960..c8b9fe0 100644
--- a/packages/SystemUI/monet/src/com/android/systemui/monet/Shades.java
+++ b/packages/SystemUI/monet/src/com/android/systemui/monet/Shades.java
@@ -21,7 +21,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.ColorUtils;
-
/**
* Generate sets of colors that are shades of the same color
*/
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
index fefe5a0..3395268 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
@@ -66,6 +66,7 @@
import java.util.Collections;
import java.util.Optional;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
index 9b0b5de..f3de463e 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
@@ -118,6 +118,8 @@
import dagger.Lazy;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -132,8 +134,6 @@
import java.util.ArrayList;
import java.util.List;
-import kotlinx.coroutines.CoroutineScope;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
@RunWithLooper(setAsMainLooper = true)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
index b83c0ce..ecfcc90 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
@@ -38,6 +38,7 @@
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.domain.interactor.sceneContainerStartable
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.fakeSceneDataSource
import com.android.systemui.testKosmos
@@ -67,10 +68,13 @@
private val testScope = kosmos.testScope
private val authenticationInteractor by lazy { kosmos.authenticationInteractor }
private val bouncerInteractor by lazy { kosmos.bouncerInteractor }
+ private val sceneContainerStartable = kosmos.sceneContainerStartable
+
private lateinit var underTest: BouncerViewModel
@Before
fun setUp() {
+ sceneContainerStartable.start()
underTest = kosmos.bouncerViewModel
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt
index 6b2a1d5..e9dc261 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt
@@ -654,7 +654,7 @@
}
@Test
- fun authenticateFallbacksToDetectionWhenUserIsAlreadyTrustedByTrustManager() =
+ fun authenticateFallbacksToDetectionWhenKeyguardIsAlreadyDismissible() =
testScope.runTest {
whenever(faceManager.sensorPropertiesInternal)
.thenReturn(listOf(createFaceSensorProperties(supportsFaceDetection = true)))
@@ -663,7 +663,7 @@
initCollectors()
allPreconditionsToRunFaceAuthAreTrue()
- trustRepository.setCurrentUserTrusted(true)
+ keyguardRepository.setKeyguardDismissible(true)
assertThat(canFaceAuthRun()).isFalse()
underTest.requestAuthenticate(
FACE_AUTH_TRIGGERED_SWIPE_UP_ON_BOUNCER,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java
index e2e5169..2b3f40f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java
@@ -49,6 +49,8 @@
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.statusbar.BlurUtils;
+import kotlinx.coroutines.CoroutineDispatcher;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -56,8 +58,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineDispatcher;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
@RunWithLooper(setAsMainLooper = true)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/AssistantAttentionConditionTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/AssistantAttentionConditionTest.java
index cb5702ad..ccadd14 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/AssistantAttentionConditionTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/AssistantAttentionConditionTest.java
@@ -31,6 +31,8 @@
import com.android.systemui.assist.AssistManager.VisualQueryAttentionListener;
import com.android.systemui.shared.condition.Condition;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,8 +40,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineScope;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
@android.platform.test.annotations.EnabledOnRavenwood
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/DreamConditionTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/DreamConditionTest.java
index 96d3c93..58c17e2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/DreamConditionTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/conditions/DreamConditionTest.java
@@ -34,6 +34,8 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.shared.condition.Condition;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -41,8 +43,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineScope;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
@android.platform.test.annotations.EnabledOnRavenwood
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
index 719828c..d2a458c 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
@@ -29,6 +29,7 @@
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
+import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository
@@ -38,6 +39,8 @@
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
import com.android.systemui.qs.ui.adapter.FakeQSSceneAdapter
import com.android.systemui.res.R
+import com.android.systemui.scene.domain.interactor.sceneBackInteractor
+import com.android.systemui.scene.domain.interactor.sceneContainerStartable
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.settings.brightness.ui.viewmodel.brightnessMirrorViewModel
@@ -58,6 +61,7 @@
@SmallTest
@RunWith(AndroidJUnit4::class)
+@EnableSceneContainer
class QuickSettingsSceneViewModelTest : SysuiTestCase() {
private val kosmos = testKosmos()
@@ -71,6 +75,8 @@
private val footerActionsController = mock<FooterActionsController>()
private val sceneInteractor = kosmos.sceneInteractor
+ private val sceneBackInteractor = kosmos.sceneBackInteractor
+ private val sceneContainerStartable = kosmos.sceneContainerStartable
private lateinit var underTest: QuickSettingsSceneViewModel
@@ -79,6 +85,7 @@
fun setUp() {
kosmos.fakeFeatureFlagsClassic.set(Flags.NEW_NETWORK_SLICE_UI, false)
+ sceneContainerStartable.start()
underTest =
QuickSettingsSceneViewModel(
applicationScope = testScope.backgroundScope,
@@ -89,7 +96,7 @@
notifications = kosmos.notificationsPlaceholderViewModel,
footerActionsViewModelFactory = footerActionsViewModelFactory,
footerActionsController = footerActionsController,
- sceneInteractor = sceneInteractor,
+ sceneBackInteractor = sceneBackInteractor,
)
}
@@ -127,11 +134,12 @@
val destinations by collectLastValue(underTest.destinationScenes)
val currentScene by collectLastValue(sceneInteractor.currentScene)
- val previousScene by collectLastValue(sceneInteractor.previousScene())
+ val backScene by collectLastValue(sceneBackInteractor.backScene)
sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
sceneInteractor.changeScene(Scenes.QuickSettings, "reason")
assertThat(currentScene).isEqualTo(Scenes.QuickSettings)
- assertThat(previousScene).isEqualTo(Scenes.Lockscreen)
+ assertThat(backScene).isEqualTo(Scenes.Lockscreen)
+
assertThat(destinations)
.isEqualTo(
mapOf(
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
index 8e2eea1..a45ac9f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
@@ -140,23 +140,4 @@
ObservableTransitionState.Idle(kosmos.sceneContainerConfig.initialSceneKey)
)
}
-
- @Test
- fun previousScene() =
- testScope.runTest {
- val underTest = kosmos.sceneContainerRepository
- val currentScene by collectLastValue(underTest.currentScene)
- val previousScene by collectLastValue(underTest.previousScene)
-
- assertThat(previousScene).isNull()
-
- val firstScene = currentScene
- underTest.changeScene(Scenes.Shade)
- assertThat(previousScene).isEqualTo(firstScene)
- assertThat(currentScene).isEqualTo(Scenes.Shade)
-
- underTest.changeScene(Scenes.QuickSettings)
- assertThat(previousScene).isEqualTo(Scenes.Shade)
- assertThat(currentScene).isEqualTo(Scenes.QuickSettings)
- }
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
new file mode 100644
index 0000000..c75e297
--- /dev/null
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@file:OptIn(ExperimentalCoroutinesApi::class)
+
+package com.android.systemui.scene.domain.interactor
+
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import com.android.compose.animation.scene.SceneKey
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
+import com.android.systemui.authentication.domain.interactor.AuthenticationResult
+import com.android.systemui.authentication.domain.interactor.authenticationInteractor
+import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.flags.EnableSceneContainer
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.shared.model.Scenes
+import com.android.systemui.testKosmos
+import com.google.common.truth.Truth.assertThat
+import com.google.common.truth.Truth.assertWithMessage
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.runCurrent
+import kotlinx.coroutines.test.runTest
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class SceneBackInteractorTest : SysuiTestCase() {
+
+ private val kosmos = testKosmos()
+ private val testScope = kosmos.testScope
+ private val sceneInteractor = kosmos.sceneInteractor
+ private val sceneContainerStartable = kosmos.sceneContainerStartable
+ private val authenticationInteractor = kosmos.authenticationInteractor
+
+ private val underTest = kosmos.sceneBackInteractor
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_thenBouncer_thenBack_whileLocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+
+ assertRoute(
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.Shade, Scenes.Lockscreen),
+ RouteNode(Scenes.QuickSettings, Scenes.Shade),
+ RouteNode(Scenes.Bouncer, Scenes.QuickSettings),
+ RouteNode(Scenes.QuickSettings, Scenes.Shade),
+ RouteNode(Scenes.Shade, Scenes.Lockscreen),
+ RouteNode(Scenes.Lockscreen, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_thenBouncer_thenUnlock() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+
+ assertRoute(
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.Shade, Scenes.Lockscreen),
+ RouteNode(Scenes.QuickSettings, Scenes.Shade),
+ RouteNode(Scenes.Bouncer, Scenes.QuickSettings, unlockDevice = true),
+ RouteNode(Scenes.Gone, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_skippingShade_thenBouncer_thenBack_whileLocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+
+ assertRoute(
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.QuickSettings, Scenes.Lockscreen),
+ RouteNode(Scenes.Bouncer, Scenes.QuickSettings),
+ RouteNode(Scenes.QuickSettings, Scenes.Lockscreen),
+ RouteNode(Scenes.Lockscreen, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToBouncer_thenBack_whileLocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+
+ assertRoute(
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.Bouncer, Scenes.Lockscreen),
+ RouteNode(Scenes.Lockscreen, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_skippingShade_thenBouncer_thenBack_thenShade_whileLocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+
+ assertRoute(
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.QuickSettings, Scenes.Lockscreen),
+ RouteNode(Scenes.Bouncer, Scenes.QuickSettings),
+ RouteNode(Scenes.QuickSettings, Scenes.Lockscreen),
+ RouteNode(Scenes.Lockscreen, null),
+ RouteNode(Scenes.Shade, Scenes.Lockscreen),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_thenBack_whileUnlocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+ unlockDevice()
+
+ assertRoute(
+ RouteNode(Scenes.Gone, null),
+ RouteNode(Scenes.Shade, Scenes.Gone),
+ RouteNode(Scenes.QuickSettings, Scenes.Shade),
+ RouteNode(Scenes.Shade, Scenes.Gone),
+ RouteNode(Scenes.Gone, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_skippingShade_thenBack_whileUnlocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+ unlockDevice()
+
+ assertRoute(
+ RouteNode(Scenes.Gone, null),
+ RouteNode(Scenes.QuickSettings, Scenes.Gone),
+ RouteNode(Scenes.Gone, null),
+ )
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun navigateToQs_skippingShade_thenBack_thenShade_whileUnlocked() =
+ testScope.runTest {
+ sceneContainerStartable.start()
+ unlockDevice()
+
+ assertRoute(
+ RouteNode(Scenes.Gone, null),
+ RouteNode(Scenes.QuickSettings, Scenes.Gone),
+ RouteNode(Scenes.Gone, null),
+ RouteNode(Scenes.Shade, Scenes.Gone),
+ )
+ }
+
+ private suspend fun TestScope.assertRoute(vararg route: RouteNode) {
+ val currentScene by collectLastValue(sceneInteractor.currentScene)
+ val backScene by collectLastValue(underTest.backScene)
+
+ route.forEachIndexed { index, node ->
+ sceneInteractor.changeScene(node.changeSceneTo, "")
+ assertWithMessage("node at index $index currentScene mismatch")
+ .that(currentScene)
+ .isEqualTo(node.changeSceneTo)
+ assertWithMessage("node at index $index backScene mismatch")
+ .that(backScene)
+ .isEqualTo(node.expectedBackScene)
+ if (node.unlockDevice) {
+ unlockDevice()
+ }
+ }
+ }
+
+ private suspend fun TestScope.unlockDevice() {
+ val currentScene by collectLastValue(sceneInteractor.currentScene)
+ runCurrent()
+ assertThat(authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN))
+ .isEqualTo(AuthenticationResult.SUCCEEDED)
+ assertThat(currentScene).isEqualTo(Scenes.Gone)
+ }
+
+ private data class RouteNode(
+ val changeSceneTo: SceneKey,
+ val expectedBackScene: SceneKey? = null,
+ val unlockDevice: Boolean = false,
+ )
+}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
index 871ce6d..2fb8212 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
@@ -291,34 +291,4 @@
assertThat(isVisible).isFalse()
}
-
- @Test
- fun previousScene() =
- testScope.runTest {
- val currentScene by collectLastValue(underTest.currentScene)
- val previousScene by collectLastValue(underTest.previousScene())
- assertThat(previousScene).isNull()
-
- val firstScene = currentScene
- underTest.changeScene(toScene = Scenes.Shade, "reason")
- assertThat(previousScene).isEqualTo(firstScene)
-
- underTest.changeScene(toScene = Scenes.QuickSettings, "reason")
- assertThat(previousScene).isEqualTo(Scenes.Shade)
- }
-
- @Test
- fun previousScene_withIgnoredScene() =
- testScope.runTest {
- val currentScene by collectLastValue(underTest.currentScene)
- val previousScene by collectLastValue(underTest.previousScene(ignored = Scenes.Shade))
- assertThat(previousScene).isNull()
-
- val firstScene = currentScene
- underTest.changeScene(toScene = Scenes.Shade, "reason")
- assertThat(previousScene).isEqualTo(firstScene)
-
- underTest.changeScene(toScene = Scenes.QuickSettings, "reason")
- assertThat(previousScene).isNull()
- }
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
index 2586ad541..5779e37 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
@@ -392,6 +392,7 @@
Scenes.Gone,
Scenes.Lockscreen,
Scenes.Bouncer,
+ Scenes.Gone,
Scenes.Shade,
Scenes.QuickSettings,
)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
index a8da116..e160cfc 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java
@@ -79,12 +79,12 @@
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
-import java.util.List;
-import java.util.concurrent.Executor;
-
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;
+import java.util.List;
+import java.util.concurrent.Executor;
+
@RunWith(ParameterizedAndroidJunit4.class)
@RunWithLooper(setAsMainLooper = true)
@SmallTest
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
index 7fabe33..02993b8 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
+import static android.app.Flags.FLAG_KEYGUARD_PRIVATE_NOTIFICATIONS;
import static android.app.Notification.VISIBILITY_PRIVATE;
import static android.app.NotificationManager.IMPORTANCE_HIGH;
import static android.app.NotificationManager.VISIBILITY_NO_OVERRIDE;
@@ -24,7 +25,6 @@
import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
-import static android.app.Flags.FLAG_KEYGUARD_PRIVATE_NOTIFICATIONS;
import static android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES;
import static android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE;
import static android.os.UserHandle.USER_ALL;
@@ -73,7 +73,6 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FakeFeatureFlagsClassic;
-import com.android.systemui.flags.Flags;
import com.android.systemui.log.LogWtfHandlerRule;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.OverviewProxyService;
@@ -100,14 +99,14 @@
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
+import platform.test.runner.parameterized.Parameters;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Executor;
-import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
-import platform.test.runner.parameterized.Parameters;
-
@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
index db8e14c1..0f66a93 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
@@ -62,11 +62,11 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
-import java.util.List;
-
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;
+import java.util.List;
+
@SmallTest
@TestableLooper.RunWithLooper
@RunWith(ParameterizedAndroidJunit4.class)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.java
index f66e75a..9feb914 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.java
@@ -49,6 +49,8 @@
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;
+import kotlinx.coroutines.flow.StateFlowKt;
+
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
@@ -58,12 +60,11 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
-import java.util.List;
-
-import kotlinx.coroutines.flow.StateFlowKt;
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;
+import java.util.List;
+
@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTestUtil.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTestUtil.java
index bda8619..306d6efd 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTestUtil.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTestUtil.java
@@ -16,13 +16,12 @@
package com.android.systemui.statusbar.policy;
import android.app.ActivityManager;
+import android.app.Notification;
import android.app.PendingIntent;
+import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
-
-import android.content.Context;
import android.service.notification.StatusBarNotification;
-import android.app.Notification;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
diff --git a/packages/SystemUI/plugin/ExamplePlugin/src/com/android/systemui/plugin/testoverlayplugin/SampleOverlayPlugin.java b/packages/SystemUI/plugin/ExamplePlugin/src/com/android/systemui/plugin/testoverlayplugin/SampleOverlayPlugin.java
index 79a0c35..4a0626c 100644
--- a/packages/SystemUI/plugin/ExamplePlugin/src/com/android/systemui/plugin/testoverlayplugin/SampleOverlayPlugin.java
+++ b/packages/SystemUI/plugin/ExamplePlugin/src/com/android/systemui/plugin/testoverlayplugin/SampleOverlayPlugin.java
@@ -20,9 +20,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-
import android.view.ViewTreeObserver.InternalInsetsInfo;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
+
import com.android.systemui.plugins.OverlayPlugin;
import com.android.systemui.plugins.annotations.Requires;
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/IntentButtonProvider.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/IntentButtonProvider.java
index 97dbafd..63bb24f 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/IntentButtonProvider.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/IntentButtonProvider.java
@@ -14,11 +14,11 @@
package com.android.systemui.plugins;
-import com.android.systemui.plugins.annotations.ProvidesInterface;
-
import android.content.Intent;
import android.graphics.drawable.Drawable;
+import com.android.systemui.plugins.annotations.ProvidesInterface;
+
/**
* An Intent Button represents a triggerable element in SysUI that consists of an
* Icon and an intent to trigger when it is activated (clicked, swiped, etc.).
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java
index f79cd86..4113c04 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationPersonExtractorPlugin.java
@@ -17,7 +17,6 @@
package com.android.systemui.plugins;
import android.annotation.Nullable;
-import android.app.PendingIntent;
import android.graphics.drawable.Drawable;
import android.service.notification.StatusBarNotification;
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginUtils.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginUtils.java
index af49d43..acb6f11 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginUtils.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginUtils.java
@@ -15,7 +15,6 @@
package com.android.systemui.plugins;
import android.content.Context;
-import android.view.LayoutInflater;
import android.view.View;
public class PluginUtils {
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java
index 02085b9..4c5ca2fd 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java
@@ -19,7 +19,6 @@
import com.android.systemui.plugins.annotations.DependsOn;
import com.android.systemui.plugins.annotations.ProvidesInterface;
-
/**
* Sends updates to {@link StateListener}s about changes to the status bar state and dozing state
*/
diff --git a/packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java b/packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java
index bb93367..8ff6c11 100644
--- a/packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java
+++ b/packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java
@@ -13,10 +13,10 @@
*/
package com.android.systemui.plugins;
-import com.android.systemui.plugins.annotations.Requires;
-
import android.content.Context;
+import com.android.systemui.plugins.annotations.Requires;
+
/**
* Plugins are separate APKs that
* are expected to implement interfaces provided by SystemUI. Their
diff --git a/packages/SystemUI/res/drawable/face_dialog_dark_to_checkmark.xml b/packages/SystemUI/res/drawable/face_dialog_dark_to_checkmark.xml
index fe19516..fb30249 100644
--- a/packages/SystemUI/res/drawable/face_dialog_dark_to_checkmark.xml
+++ b/packages/SystemUI/res/drawable/face_dialog_dark_to_checkmark.xml
@@ -40,7 +40,7 @@
<path
android:name="_R_G_L_0_G_D_0_P_0"
android:fillAlpha="0"
- android:fillColor="@color/biometric_dialog_accent"
+ android:fillColor="@color/biometric_dialog_face_checkmark"
android:fillType="nonZero"
android:pathData=" M-116 -16.5 C-116,-16.5 -31.25,68.5 -31.25,68.5 C-31.25,68.5 108.75,-71.5 108.75,-71.5 "
android:trimPathStart="0"
@@ -58,7 +58,7 @@
android:pathData=" M-116 -16.5 C-116,-16.5 -31.25,68.5 -31.25,68.5 C-31.25,68.5 108.75,-71.5 108.75,-71.5 "
android:strokeWidth="20"
android:strokeAlpha="1"
- android:strokeColor="@color/biometric_dialog_accent"
+ android:strokeColor="@color/biometric_dialog_face_checkmark"
android:trimPathStart="0"
android:trimPathEnd="0"
android:trimPathOffset="0" />
@@ -68,7 +68,7 @@
android:pathData=" M30 6.2 C16.9,6.2 6.3,16.8 6.3,30 C6.3,43.2 16.9,53.8 30,53.8 C43.1,53.8 53.8,43.2 53.8,30 C53.8,16.8 43.1,6.2 30,6.2c "
android:strokeWidth="2.5"
android:strokeAlpha="1"
- android:strokeColor="@color/biometric_dialog_accent"
+ android:strokeColor="@color/biometric_dialog_face_checkmark"
android:trimPathStart="0"
android:trimPathEnd="1"
android:trimPathOffset="0" />
@@ -387,7 +387,7 @@
android:propertyName="strokeColor"
android:startOffset="0"
android:valueFrom="@color/biometric_dialog_accent"
- android:valueTo="@color/biometric_dialog_accent"
+ android:valueTo="@color/biometric_dialog_face_checkmark"
android:valueType="colorType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
@@ -398,7 +398,7 @@
android:propertyName="strokeColor"
android:startOffset="67"
android:valueFrom="@color/biometric_dialog_accent"
- android:valueTo="@color/biometric_dialog_accent"
+ android:valueTo="@color/biometric_dialog_face_checkmark"
android:valueType="colorType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
diff --git a/packages/SystemUI/res/layout/screenshot_shelf.xml b/packages/SystemUI/res/layout/screenshot_shelf.xml
index 26d3f43..79b82bf 100644
--- a/packages/SystemUI/res/layout/screenshot_shelf.xml
+++ b/packages/SystemUI/res/layout/screenshot_shelf.xml
@@ -59,7 +59,7 @@
android:layout_marginTop="@dimen/overlay_border_width_neg"
android:layout_marginEnd="@dimen/overlay_border_width_neg"
android:layout_marginBottom="@dimen/screenshot_shelf_vertical_margin"
- android:elevation="8dp"
+ android:elevation="4dp"
android:background="@drawable/overlay_border"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/screenshot_preview"
@@ -72,7 +72,7 @@
android:layout_marginStart="@dimen/overlay_border_width"
android:layout_marginBottom="@dimen/overlay_border_width"
android:layout_gravity="center"
- android:elevation="8dp"
+ android:elevation="4dp"
android:contentDescription="@string/screenshot_edit_description"
android:scaleType="fitEnd"
android:background="@drawable/overlay_preview_background"
@@ -85,14 +85,14 @@
android:layout_width="56dp"
android:layout_height="56dp"
android:visibility="gone"
- android:elevation="9dp"
+ android:elevation="5dp"
app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"
app:layout_constraintEnd_toEndOf="@id/screenshot_preview_border"/>
<FrameLayout
android:id="@+id/screenshot_dismiss_button"
android:layout_width="@dimen/overlay_dismiss_button_tappable_size"
android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
- android:elevation="11dp"
+ android:elevation="7dp"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/screenshot_preview"
app:layout_constraintEnd_toEndOf="@id/screenshot_preview"
diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml
index 61a323d4..d377e01 100644
--- a/packages/SystemUI/res/values-night/colors.xml
+++ b/packages/SystemUI/res/values-night/colors.xml
@@ -77,6 +77,7 @@
<color name="biometric_dialog_gray">#ffcccccc</color>
<color name="biometric_dialog_accent">@color/material_dynamic_primary70</color>
<color name="biometric_dialog_error">#fff28b82</color> <!-- red 300 -->
+ <color name="biometric_dialog_face_checkmark">#5bb974</color> <!-- green 400 -->
<color name="GM2_green_500">#FF41Af6A</color>
<color name="GM2_blue_500">#5195EA</color>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 590dc68..ba59c2f9 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -140,6 +140,7 @@
<color name="biometric_dialog_gray">#ff757575</color>
<color name="biometric_dialog_accent">@color/material_dynamic_primary40</color>
<color name="biometric_dialog_error">#ffd93025</color> <!-- red 600 -->
+ <color name="biometric_dialog_face_checkmark">#34A853</color> <!-- green 500 -->
<!-- SFPS colors -->
<color name="sfps_chevron_fill">@color/material_dynamic_primary90</color>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/UiBackground.java b/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/UiBackground.java
index bf2237a..3d37468 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/UiBackground.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/dagger/qualifiers/UiBackground.java
@@ -23,7 +23,6 @@
import javax.inject.Qualifier;
-
/**
* An annotation for injecting instances related to UI operations off the main-thread.
*/
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/condition/Condition.java b/packages/SystemUI/shared/src/com/android/systemui/shared/condition/Condition.java
index 9bead94..670feeb 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/condition/Condition.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/condition/Condition.java
@@ -24,6 +24,8 @@
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
+import kotlinx.coroutines.CoroutineScope;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
@@ -33,8 +35,6 @@
import java.util.Iterator;
import java.util.List;
-import kotlinx.coroutines.CoroutineScope;
-
/**
* Base class for a condition that needs to be fulfilled in order for {@link Monitor} to inform
* its callbacks.
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java
index 400f652..87b473f 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java
@@ -17,7 +17,6 @@
package com.android.systemui.shared.rotation;
import static android.content.pm.PackageManager.FEATURE_PC;
-import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.internal.view.RotationPolicy.NATURAL_ROTATION;
@@ -38,8 +37,6 @@
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
-import android.os.HandlerExecutor;
-import android.os.HandlerThread;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemProperties;
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java
index 5647b0b..3f34df7 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java
@@ -49,6 +49,8 @@
import com.android.systemui.telephony.TelephonyListenerManager;
import com.android.systemui.util.kotlin.JavaAdapter;
+import kotlinx.coroutines.Job;
+
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@@ -58,8 +60,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.Job;
-
/**
* Controller that generates text including the carrier names and/or the status of all the SIM
* interfaces in the device. Through a callback, the updates can be retrieved either as a list or
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
index fb331b6..4af366c 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
@@ -49,7 +49,6 @@
import javax.inject.Inject;
-
@SysUISingleton
public class KeyguardDisplayManager {
protected static final String TAG = "KeyguardDisplayManager";
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
index 75d925d..db14a0f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
@@ -47,7 +47,6 @@
import javax.inject.Inject;
-
/** Controller for a {@link KeyguardSecurityView}. */
public abstract class KeyguardInputViewController<T extends KeyguardInputView>
extends ViewController<T> implements KeyguardSecurityView {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
index 26e91b6..641c5dd 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
@@ -58,7 +58,6 @@
import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DevicePostureController;
-
/**
* Displays an alphanumeric (latin-1) key entry for the user to enter
* an unlock password
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java
index ec2999f..120045f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java
@@ -30,8 +30,8 @@
import com.android.keyguard.KeyguardInputViewController.Factory;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.dagger.KeyguardBouncerScope;
-import com.android.systemui.res.R;
import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.res.R;
import com.android.systemui.util.ViewController;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
index 151ca8a..d2221c2 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
@@ -24,7 +24,6 @@
import com.android.systemui.res.R;
-
/**
* Displays a PIN pad for entering a PUK (Pin Unlock Kode) provided by a carrier.
*/
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUserSwitcherPopupMenu.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUserSwitcherPopupMenu.java
index f746459..6b8673e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUserSwitcherPopupMenu.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUserSwitcherPopupMenu.java
@@ -25,8 +25,8 @@
import android.widget.ListPopupWindow;
import android.widget.ListView;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.res.R;
/**
* Custom user-switcher for use on the bouncer.
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
index afeb0f8..9513c8e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
@@ -27,7 +27,6 @@
import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
-import com.android.systemui.statusbar.phone.KeyguardBypassController;
/**
* Interface to control Keyguard View. It should be implemented by KeyguardViewManagers, which
diff --git a/packages/SystemUI/src/com/android/keyguard/LegacyLockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LegacyLockIconViewController.java
index cf2675b..a9fd340 100644
--- a/packages/SystemUI/src/com/android/keyguard/LegacyLockIconViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/LegacyLockIconViewController.java
@@ -83,14 +83,14 @@
import dagger.Lazy;
+import kotlinx.coroutines.ExperimentalCoroutinesApi;
+
import java.io.PrintWriter;
import java.util.Objects;
import java.util.function.Consumer;
import javax.inject.Inject;
-import kotlinx.coroutines.ExperimentalCoroutinesApi;
-
/**
* Controls when to show the LockIcon affordance (lock/unlocked icon or circle) on lock screen.
*
diff --git a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardBouncerComponent.java b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardBouncerComponent.java
index b57c2b5..786965a 100644
--- a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardBouncerComponent.java
+++ b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardBouncerComponent.java
@@ -19,8 +19,8 @@
import android.view.ViewGroup;
import com.android.keyguard.KeyguardSecurityContainerController;
-import com.android.systemui.dagger.qualifiers.RootView;
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor;
+import com.android.systemui.dagger.qualifiers.RootView;
import dagger.BindsInstance;
import dagger.Subcomponent;
diff --git a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewModule.java b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewModule.java
index 37600da..8fb5204 100644
--- a/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewModule.java
+++ b/packages/SystemUI/src/com/android/keyguard/dagger/KeyguardStatusBarViewModule.java
@@ -17,8 +17,8 @@
package com.android.keyguard.dagger;
import com.android.keyguard.CarrierText;
-import com.android.systemui.res.R;
import com.android.systemui.battery.BatteryMeterView;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.KeyguardStatusBarView;
import com.android.systemui.statusbar.phone.StatusBarLocation;
import com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer;
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 33f14d4..a42f4c2d 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -64,7 +64,6 @@
import javax.inject.Inject;
import javax.inject.Named;
-
/**
* Class to handle ugly dependencies throughout sysui until we determine the
* long-term dependency injection solution.
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 086713f..57c1fd0 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -36,10 +36,9 @@
import androidx.core.animation.AnimatorListenerAdapter;
import androidx.core.animation.ObjectAnimator;
-import com.android.systemui.res.R;
-
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.policy.ScrollAdapter;
diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java b/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java
index ab431d0..09526a3 100644
--- a/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java
@@ -37,11 +37,11 @@
import android.widget.ListView;
import android.widget.TextView;
-import com.android.systemui.res.R;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.systemui.res.R;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java b/packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java
index 0f5f869..13b6672 100644
--- a/packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java
+++ b/packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java
@@ -24,7 +24,6 @@
import androidx.annotation.NonNull;
-import com.android.systemui.res.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.GuestResetOrExitSessionReceiver.ResetSessionDialogFactory;
@@ -32,6 +31,7 @@
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.qs.QSUserSwitcherEvent;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.UserSwitcherController;
diff --git a/packages/SystemUI/src/com/android/systemui/GuestSessionNotification.java b/packages/SystemUI/src/com/android/systemui/GuestSessionNotification.java
index 161cb43..06d126c 100644
--- a/packages/SystemUI/src/com/android/systemui/GuestSessionNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/GuestSessionNotification.java
@@ -26,8 +26,8 @@
import android.os.UserHandle;
import android.provider.Settings;
-import com.android.systemui.res.R;
import com.android.internal.messages.nano.SystemMessageProto;
+import com.android.systemui.res.R;
import com.android.systemui.util.NotificationChannels;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
index 0643d02..d3bda8e 100644
--- a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
@@ -23,8 +23,8 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
-import com.android.systemui.res.R;
import com.android.settingslib.Utils;
+import com.android.systemui.res.R;
public class HardwareBgDrawable extends LayerDrawable {
diff --git a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
index b9e412c..302ea39 100644
--- a/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/PluginInflateContainer.java
@@ -20,10 +20,10 @@
import android.util.Log;
import android.view.View;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.ViewProvider;
+import com.android.systemui.res.R;
/**
* Define an interface or abstract class as follows that includes the
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapter.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapter.java
index 83ad3c2..5160309 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapter.java
@@ -29,8 +29,8 @@
import com.android.internal.accessibility.common.ShortcutConstants.AccessibilityFragmentType;
import com.android.internal.accessibility.dialog.AccessibilityTarget;
-import com.android.systemui.res.R;
import com.android.systemui.accessibility.floatingmenu.AccessibilityTargetAdapter.ViewHolder;
+import com.android.systemui.res.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuEduTooltipView.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuEduTooltipView.java
index 1ff9eb4..c4274ea 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuEduTooltipView.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuEduTooltipView.java
@@ -41,8 +41,8 @@
import androidx.annotation.NonNull;
import com.android.settingslib.Utils;
-import com.android.systemui.res.R;
import com.android.systemui.recents.TriangleShape;
+import com.android.systemui.res.R;
/**
* The tooltip view shows the information about the operation of the anchor view {@link MenuView}
diff --git a/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/InputSessionModule.java b/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/InputSessionModule.java
index 99dbdee..5875ffc 100644
--- a/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/InputSessionModule.java
+++ b/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/InputSessionModule.java
@@ -28,7 +28,6 @@
import javax.inject.Named;
-
/**
* Module for providing dependencies to {@link com.android.systemui.dreams.touch.InputSession}.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java b/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
index f9138b6..b0eddea 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
@@ -26,11 +26,11 @@
import com.android.internal.app.AssistUtils;
import com.android.systemui.dagger.SysUISingleton;
-import javax.inject.Named;
-
import dagger.Module;
import dagger.Provides;
+import javax.inject.Named;
+
/** Module for dagger injections related to the Assistant. */
@Module
public abstract class AssistModule {
diff --git a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
index dfff00b..e425f29 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
@@ -38,14 +38,14 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.CentralSurfaces;
+import dagger.Lazy;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.inject.Inject;
-import dagger.Lazy;
-
/** Class to monitor and report the state of the phone. */
@SysUISingleton
public final class PhoneStateMonitor {
diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java
index 5b840b5..3cb612f 100644
--- a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterViewController.java
@@ -30,11 +30,11 @@
import androidx.annotation.NonNull;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarLocation;
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index fd0e7fc..ea5c5da 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -87,6 +87,8 @@
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.util.concurrency.DelayableExecutor;
+import kotlinx.coroutines.CoroutineScope;
+
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -96,8 +98,6 @@
import javax.inject.Provider;
-import kotlinx.coroutines.CoroutineScope;
-
/**
* Top level container/controller for the BiometricPrompt UI.
*
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
index b25c3da..fb718d3 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java
@@ -110,6 +110,9 @@
import kotlin.Unit;
+import kotlinx.coroutines.CoroutineScope;
+import kotlinx.coroutines.ExperimentalCoroutinesApi;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -118,9 +121,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.CoroutineScope;
-import kotlinx.coroutines.ExperimentalCoroutinesApi;
-
/**
* Shows and hides the under-display fingerprint sensor (UDFPS) overlay, handles UDFPS touch events,
* and toggles the UDFPS display mode.
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
index 245817e..4bdbfa2 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt
@@ -122,11 +122,9 @@
val overlayViewModel =
SideFpsOverlayViewModel(
applicationContext,
- biometricStatusInteractor.get(),
deviceEntrySideFpsOverlayInteractor.get(),
displayStateInteractor.get(),
sfpsSensorInteractor.get(),
- sideFpsProgressBarViewModel.get()
)
bind(overlayView!!, overlayViewModel, fpsUnlockTracker.get(), windowManager.get())
overlayView!!.visibility = View.INVISIBLE
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt
index 412d0c3..19ea007 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModel.kt
@@ -30,7 +30,6 @@
import com.airbnb.lottie.model.KeyPath
import com.android.systemui.Flags.constraintBp
import com.android.systemui.biometrics.Utils
-import com.android.systemui.biometrics.domain.interactor.BiometricStatusInteractor
import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractor
import com.android.systemui.biometrics.domain.interactor.SideFpsSensorInteractor
import com.android.systemui.biometrics.domain.model.SideFpsSensorLocation
@@ -38,7 +37,6 @@
import com.android.systemui.biometrics.shared.model.LottieCallback
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.keyguard.domain.interactor.DeviceEntrySideFpsOverlayInteractor
-import com.android.systemui.keyguard.ui.viewmodel.SideFpsProgressBarViewModel
import com.android.systemui.res.R
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
@@ -54,11 +52,9 @@
@Inject
constructor(
@Application private val applicationContext: Context,
- biometricStatusInteractor: BiometricStatusInteractor,
deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor,
displayStateInteractor: DisplayStateInteractor,
sfpsSensorInteractor: SideFpsSensorInteractor,
- sideFpsProgressBarViewModel: SideFpsProgressBarViewModel
) {
/** Contains properties of the side fingerprint sensor indicator */
data class OverlayViewProperties(
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
index cb458ef..45e39ca 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
@@ -34,7 +34,7 @@
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.log.SessionTracker
import com.android.systemui.power.domain.interactor.PowerInteractor
-import com.android.systemui.scene.domain.interactor.SceneInteractor
+import com.android.systemui.scene.domain.interactor.SceneBackInteractor
import com.android.systemui.scene.shared.model.Scenes
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
@@ -59,7 +59,7 @@
private val powerInteractor: PowerInteractor,
private val uiEventLogger: UiEventLogger,
private val sessionTracker: SessionTracker,
- sceneInteractor: SceneInteractor,
+ sceneBackInteractor: SceneBackInteractor,
) {
private val _onIncorrectBouncerInput = MutableSharedFlow<Unit>()
val onIncorrectBouncerInput: SharedFlow<Unit> = _onIncorrectBouncerInput
@@ -95,7 +95,9 @@
/** The scene to show when bouncer is dismissed. */
val dismissDestination: Flow<SceneKey> =
- sceneInteractor.previousScene(Scenes.Bouncer).map { it ?: Scenes.Lockscreen }
+ sceneBackInteractor.backScene
+ .filter { it != Scenes.Bouncer }
+ .map { it ?: Scenes.Lockscreen }
/** Notifies that the user has places down a pointer, not necessarily dragging just yet. */
fun onDown() {
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
index 0123857..82fe2f1 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/ProximityClassifier.java
@@ -33,7 +33,6 @@
import javax.inject.Inject;
-
/**
* False touch if proximity sensor is covered for more than a certain percentage of the gesture.
*
diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java
index bfc80a7..bd0e729 100644
--- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java
+++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java
@@ -18,7 +18,6 @@
import static android.content.Intent.ACTION_CLOSE_SYSTEM_DIALOGS;
-
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.CLIPBOARD_OVERLAY_SHOW_ACTIONS;
import static com.android.systemui.clipboardoverlay.ClipboardOverlayEvent.CLIPBOARD_OVERLAY_ACTION_SHOWN;
import static com.android.systemui.clipboardoverlay.ClipboardOverlayEvent.CLIPBOARD_OVERLAY_ACTION_TAPPED;
diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/dagger/ClipboardOverlayModule.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/dagger/ClipboardOverlayModule.java
index 0fd34bd..ff9fba4 100644
--- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/dagger/ClipboardOverlayModule.java
+++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/dagger/ClipboardOverlayModule.java
@@ -25,18 +25,18 @@
import android.view.Display;
import android.view.LayoutInflater;
-import com.android.systemui.res.R;
import com.android.systemui.clipboardoverlay.ClipboardOverlayView;
+import com.android.systemui.res.R;
import com.android.systemui.settings.DisplayTracker;
+import dagger.Module;
+import dagger.Provides;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import javax.inject.Qualifier;
-import dagger.Module;
-import dagger.Provides;
-
/** Module for {@link com.android.systemui.clipboardoverlay}. */
@Module
public interface ClipboardOverlayModule {
diff --git a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
index 7fa091a..2406cc6 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
@@ -76,7 +76,12 @@
val config =
SceneContainerConfig(
sceneKeys = listOf(CommunalScenes.Blank, CommunalScenes.Communal),
- initialSceneKey = CommunalScenes.Blank
+ initialSceneKey = CommunalScenes.Blank,
+ navigationDistances =
+ mapOf(
+ CommunalScenes.Blank to 0,
+ CommunalScenes.Communal to 1,
+ ),
)
return SceneDataSourceDelegator(applicationScope, config)
}
diff --git a/packages/SystemUI/src/com/android/systemui/complication/ComplicationLayoutEngine.java b/packages/SystemUI/src/com/android/systemui/complication/ComplicationLayoutEngine.java
index f7b6b0f..15ec4d4 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/ComplicationLayoutEngine.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/ComplicationLayoutEngine.java
@@ -40,10 +40,10 @@
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Constraints;
-import com.android.systemui.res.R;
import com.android.systemui.complication.ComplicationLayoutParams.Direction;
import com.android.systemui.complication.ComplicationLayoutParams.Position;
import com.android.systemui.complication.dagger.ComplicationModule;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.touch.TouchInsetManager;
diff --git a/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationHostViewModule.java b/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationHostViewModule.java
index 712213a..9dd48ea 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationHostViewModule.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationHostViewModule.java
@@ -22,8 +22,8 @@
import androidx.constraintlayout.widget.ConstraintLayout;
import com.android.internal.util.Preconditions;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import dagger.Module;
import dagger.Provides;
diff --git a/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationModule.java b/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationModule.java
index 57841af..9475372 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationModule.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/dagger/ComplicationModule.java
@@ -34,6 +34,7 @@
import javax.inject.Named;
import javax.inject.Scope;
+
/**
* Module for housing components related to rendering complications.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamHomeControlsComplicationComponent.java b/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamHomeControlsComplicationComponent.java
index b6dcfcb..63ac77d 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamHomeControlsComplicationComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamHomeControlsComplicationComponent.java
@@ -34,7 +34,6 @@
import dagger.Provides;
import dagger.Subcomponent;
-
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
diff --git a/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamMediaEntryComplicationComponent.java b/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamMediaEntryComplicationComponent.java
index c0a292c..b680393 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamMediaEntryComplicationComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/dagger/DreamMediaEntryComplicationComponent.java
@@ -21,8 +21,8 @@
import android.view.LayoutInflater;
import android.view.View;
-import com.android.systemui.res.R;
import com.android.systemui.complication.DreamMediaEntryComplication;
+import com.android.systemui.res.R;
import dagger.Module;
import dagger.Provides;
diff --git a/packages/SystemUI/src/com/android/systemui/complication/dagger/RegisteredComplicationsModule.java b/packages/SystemUI/src/com/android/systemui/complication/dagger/RegisteredComplicationsModule.java
index 92fdb1e..6f1b098 100644
--- a/packages/SystemUI/src/com/android/systemui/complication/dagger/RegisteredComplicationsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/complication/dagger/RegisteredComplicationsModule.java
@@ -19,12 +19,12 @@
import android.content.res.Resources;
import android.view.ViewGroup;
-import com.android.systemui.res.R;
import com.android.systemui.complication.ComplicationLayoutParams;
import com.android.systemui.dagger.SystemUIBinder;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
+import com.android.systemui.res.R;
import dagger.Module;
import dagger.Provides;
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/NightDisplayListenerModule.java b/packages/SystemUI/src/com/android/systemui/dagger/NightDisplayListenerModule.java
index 7091105..42fca7d 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/NightDisplayListenerModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/NightDisplayListenerModule.java
@@ -23,11 +23,11 @@
import com.android.systemui.dagger.qualifiers.Background;
-import javax.inject.Inject;
-
import dagger.Module;
import dagger.Provides;
+import javax.inject.Inject;
+
/**
* Module for providing a {@link NightDisplayListener}.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceGlobalRootComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceGlobalRootComponent.java
index be93c9f..c663db0 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceGlobalRootComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceGlobalRootComponent.java
@@ -16,10 +16,10 @@
package com.android.systemui.dagger;
-import javax.inject.Singleton;
-
import dagger.Component;
+import javax.inject.Singleton;
+
/**
* Root component for Dagger injection used in AOSP.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/InstrumentationTest.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/InstrumentationTest.java
index a803a39..9430445 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/InstrumentationTest.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/InstrumentationTest.java
@@ -23,7 +23,6 @@
import javax.inject.Qualifier;
-
/**
* An annotation for injecting whether or not we are running in a test environment.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/TestHarness.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/TestHarness.java
index f68ab18..35c7b76 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/TestHarness.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/TestHarness.java
@@ -23,7 +23,6 @@
import javax.inject.Qualifier;
-
/**
* An annotation for injecting whether or not we are running in a test environment.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt
index e418641..f1ab4d1 100644
--- a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt
@@ -250,7 +250,10 @@
listOf(
*gatingConditionsForAuthAndDetect(),
Pair(isLockedOut.isFalse(), "isNotInLockOutState"),
- Pair(trustRepository.isCurrentUserTrusted.isFalse(), "currentUserIsNotTrusted"),
+ Pair(
+ keyguardRepository.isKeyguardDismissible.isFalse(),
+ "keyguardIsNotDismissible"
+ ),
Pair(
biometricSettingsRepository.isFaceAuthCurrentlyAllowed,
"isFaceAuthCurrentlyAllowed"
@@ -273,7 +276,7 @@
Pair(
biometricSettingsRepository.isFaceAuthCurrentlyAllowed
.isFalse()
- .or(trustRepository.isCurrentUserTrusted),
+ .or(keyguardRepository.isKeyguardDismissible),
"faceAuthIsNotCurrentlyAllowedOrCurrentUserIsTrusted"
),
// We don't want to run face detect if fingerprint can be used to unlock the
diff --git a/packages/SystemUI/src/com/android/systemui/doze/AlwaysOnDisplayPolicy.java b/packages/SystemUI/src/com/android/systemui/doze/AlwaysOnDisplayPolicy.java
index 8e542b5..e182d0b 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/AlwaysOnDisplayPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/AlwaysOnDisplayPolicy.java
@@ -28,8 +28,8 @@
import android.util.KeyValueListParser;
import android.util.Log;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSuppressor.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSuppressor.java
index de0bdd3..2cafe99 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSuppressor.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSuppressor.java
@@ -26,12 +26,12 @@
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
+import dagger.Lazy;
+
import java.io.PrintWriter;
import javax.inject.Inject;
-import dagger.Lazy;
-
/**
* Handles suppressing doze on:
* 1. INITIALIZED, don't allow dozing at all when:
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java
index 0c2709e..8c0a73c 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java
@@ -48,13 +48,13 @@
import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.util.ViewController;
+import kotlinx.coroutines.CoroutineDispatcher;
+
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Named;
-import kotlinx.coroutines.CoroutineDispatcher;
-
/**
* View controller for {@link DreamOverlayContainerView}.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/conditions/AssistantAttentionCondition.java b/packages/SystemUI/src/com/android/systemui/dreams/conditions/AssistantAttentionCondition.java
index 4dd97d5..d81949d 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/conditions/AssistantAttentionCondition.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/conditions/AssistantAttentionCondition.java
@@ -21,10 +21,10 @@
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.shared.condition.Condition;
-import javax.inject.Inject;
-
import kotlinx.coroutines.CoroutineScope;
+import javax.inject.Inject;
+
/**
* {@link AssistantAttentionCondition} provides a signal when assistant has the user's attention.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/conditions/DreamCondition.java b/packages/SystemUI/src/com/android/systemui/dreams/conditions/DreamCondition.java
index 99688be..c7fe1e1 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/conditions/DreamCondition.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/conditions/DreamCondition.java
@@ -22,10 +22,10 @@
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.shared.condition.Condition;
-import javax.inject.Inject;
-
import kotlinx.coroutines.CoroutineScope;
+import javax.inject.Inject;
+
/**
* {@link DreamCondition} provides a signal when a dream begins and ends.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsClassicDebug.java b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsClassicDebug.java
index 72b0891..7d11d32 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsClassicDebug.java
+++ b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagsClassicDebug.java
@@ -25,6 +25,7 @@
import static com.android.systemui.flags.FlagManager.EXTRA_VALUE;
import static com.android.systemui.flags.FlagsCommonModule.ALL_FLAGS;
import static com.android.systemui.shared.Flags.exampleSharedFlag;
+
import static java.util.Objects.requireNonNull;
import android.content.BroadcastReceiver;
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java b/packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java
index 17e3ca6..1fac7f1 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java
@@ -50,8 +50,8 @@
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import com.android.systemui.CoreStartable;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.util.settings.SecureSettings;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index a5d7e04..ae163ea 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -89,14 +89,14 @@
import com.android.wm.shell.shared.TransitionUtil;
import com.android.wm.shell.transition.Transitions;
+import kotlinx.coroutines.CoroutineScope;
+
import java.util.ArrayList;
import java.util.Map;
import java.util.WeakHashMap;
import javax.inject.Inject;
-import kotlinx.coroutines.CoroutineScope;
-
public class KeyguardService extends Service {
static final String TAG = "KeyguardService";
static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
index 0d40511..dbaa297 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
@@ -48,10 +48,10 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.res.R;
import com.android.systemui.SystemUIAppComponentFactoryBase;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.StatusBarState;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
index 4f02f75..39144b5 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
@@ -30,10 +30,10 @@
import androidx.annotation.Nullable;
import com.android.systemui.Dumpable;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.power.domain.interactor.PowerInteractor;
+import com.android.systemui.res.R;
import com.android.systemui.util.time.SystemClock;
import java.io.PrintWriter;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
index 09875a5..2c5bacb 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
@@ -37,8 +37,8 @@
import android.window.OnBackInvokedDispatcher;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
index 7879ab6..4e6cfcc 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
@@ -90,11 +90,11 @@
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;
-import java.util.concurrent.Executor;
-
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
+import java.util.concurrent.Executor;
+
/**
* Dagger Module providing keyguard.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java b/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java
index d01917a..fd526b9 100644
--- a/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java
@@ -45,7 +45,6 @@
import com.android.internal.app.ILogAccessDialogCallback;
import com.android.systemui.res.R;
-
/**
* Dialog responsible for obtaining user consent per-use log access
*/
diff --git a/packages/SystemUI/src/com/android/systemui/media/systemsounds/HomeSoundEffectController.java b/packages/SystemUI/src/com/android/systemui/media/systemsounds/HomeSoundEffectController.java
index 9de2b4f..74af4ee 100644
--- a/packages/SystemUI/src/com/android/systemui/media/systemsounds/HomeSoundEffectController.java
+++ b/packages/SystemUI/src/com/android/systemui/media/systemsounds/HomeSoundEffectController.java
@@ -26,8 +26,8 @@
import android.util.Slog;
import com.android.systemui.CoreStartable;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.res.R;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarComponent.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarComponent.java
index 1d792af..4f713d6 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarComponent.java
@@ -25,14 +25,14 @@
import com.android.systemui.dagger.qualifiers.DisplayId;
+import dagger.BindsInstance;
+import dagger.Subcomponent;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import javax.inject.Scope;
-import dagger.BindsInstance;
-import dagger.Subcomponent;
-
/**
* Subcomponent for a NavigationBar.
*
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarControllerImpl.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarControllerImpl.java
index 12f2703..b177b0b 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarControllerImpl.java
@@ -74,7 +74,6 @@
import javax.inject.Inject;
-
@SysUISingleton
public class NavigationBarControllerImpl implements
ConfigurationController.ConfigurationListener,
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
index c1d98c9..2ae0709 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java
@@ -36,12 +36,12 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.navigationbar.buttons.ButtonDispatcher;
import com.android.systemui.navigationbar.buttons.KeyButtonView;
import com.android.systemui.navigationbar.buttons.ReverseLinearLayout;
import com.android.systemui.navigationbar.buttons.ReverseLinearLayout.ReverseRelativeLayout;
import com.android.systemui.recents.OverviewProxyService;
+import com.android.systemui.res.R;
import com.android.systemui.shared.system.QuickStepContract;
import java.io.PrintWriter;
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java
index 3ef5094..aab4fea 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarModule.java
@@ -21,10 +21,10 @@
import android.view.View;
import android.view.WindowManager;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.navigationbar.NavigationBarComponent.NavigationBarScope;
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
+import com.android.systemui.res.R;
import dagger.Module;
import dagger.Provides;
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarTransitions.java
index 3e34318..201e586 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarTransitions.java
@@ -24,9 +24,9 @@
import android.util.SparseArray;
import android.view.View;
-import com.android.systemui.res.R;
import com.android.systemui.navigationbar.NavigationBarComponent.NavigationBarScope;
import com.android.systemui.navigationbar.buttons.ButtonDispatcher;
+import com.android.systemui.res.R;
import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.statusbar.phone.BarTransitions;
import com.android.systemui.statusbar.phone.LightBarTransitionsController;
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java b/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java
index 939c096..1e40dd9 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/ScreenPinningNotify.java
@@ -21,8 +21,8 @@
import android.util.Slog;
import android.widget.Toast;
-import com.android.systemui.res.R;
import com.android.systemui.SysUIToast;
+import com.android.systemui.res.R;
/**
* Helper to manage showing/hiding a image to notify them that they are entering or exiting screen
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java
index bd3a0c1..3268306 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java
@@ -26,9 +26,9 @@
import android.view.Surface;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.navigationbar.NavigationBarController;
import com.android.systemui.navigationbar.NavigationBarView;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
index b50ee57..933065b 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
@@ -516,9 +516,9 @@
SystemUiDeviceConfigFlags.BACK_GESTURE_SLOP_MULTIPLIER, 0.75f);
mTouchSlop = mViewConfiguration.getScaledTouchSlop() * backGestureSlop;
mBackSwipeLinearThreshold = res.getDimension(
- R.dimen.navigation_edge_action_progress_threshold);
+ com.android.internal.R.dimen.navigation_edge_action_progress_threshold);
mNonLinearFactor = getDimenFloat(res,
- R.dimen.back_progress_non_linear_factor);
+ com.android.internal.R.dimen.back_progress_non_linear_factor);
updateBackAnimationThresholds();
}
@@ -1094,15 +1094,12 @@
return;
} else if (dx > dy && dx > mTouchSlop) {
if (mAllowGesture) {
- mThresholdCrossed = true;
- // Capture inputs
- mInputMonitor.pilferPointers();
if (mBackAnimation != null) {
- mBackAnimation.onPilferPointers();
- // Notify FalsingManager that an intentional gesture has occurred.
- mFalsingManager.isFalseTouch(BACK_GESTURE);
+ mBackAnimation.onThresholdCrossed();
+ } else {
+ pilferPointers();
}
- mInputEventReceiver.setBatchingEnabled(true);
+ mThresholdCrossed = true;
} else {
logGesture(SysUiStatsLog.BACK_GESTURE__TYPE__INCOMPLETE_FAR_FROM_EDGE);
}
@@ -1118,6 +1115,14 @@
}
}
+ private void pilferPointers() {
+ // Capture inputs
+ mInputMonitor.pilferPointers();
+ // Notify FalsingManager that an intentional gesture has occurred.
+ mFalsingManager.isFalseTouch(BACK_GESTURE);
+ mInputEventReceiver.setBatchingEnabled(true);
+ }
+
private boolean isButtonPressFromTrackpad(MotionEvent ev) {
// We don't allow back for button press from the trackpad, and yet we do with a mouse.
int sources = InputManager.getInstance().getInputDevice(ev.getDeviceId()).getSources();
@@ -1266,6 +1271,9 @@
public void setBackAnimation(BackAnimation backAnimation) {
mBackAnimation = backAnimation;
+ mBackAnimation.setPilferPointerCallback(() -> {
+ pilferPointers();
+ });
updateBackAnimationThresholds();
if (mLightBarControllerProvider.get() != null) {
mBackAnimation.setStatusBarCustomizer((appearance) -> {
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index 188e867..d23d3f6 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -55,9 +55,9 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.widget.MessagingMessage;
import com.android.settingslib.utils.ThreadUtils;
-import com.android.systemui.res.R;
import com.android.systemui.people.widget.PeopleSpaceWidgetManager;
import com.android.systemui.people.widget.PeopleTileKey;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import java.text.SimpleDateFormat;
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
index ef72967..9b57b40 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
@@ -74,11 +74,11 @@
import androidx.core.math.MathUtils;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.res.R;
import com.android.systemui.people.data.model.PeopleTileModel;
import com.android.systemui.people.widget.LaunchConversationActivity;
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
import com.android.systemui.people.widget.PeopleTileKey;
+import com.android.systemui.res.R;
import java.io.IOException;
import java.text.NumberFormat;
diff --git a/packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java b/packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java
index e6575d5a..c65742c 100644
--- a/packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/plugins/PluginDependencyProvider.java
@@ -19,11 +19,11 @@
import com.android.systemui.Dependency;
import com.android.systemui.plugins.PluginDependency.DependencyProvider;
+import dagger.Lazy;
+
import javax.inject.Inject;
import javax.inject.Singleton;
-import dagger.Lazy;
-
/**
*/
@Singleton
diff --git a/packages/SystemUI/src/com/android/systemui/plugins/PluginsModule.java b/packages/SystemUI/src/com/android/systemui/plugins/PluginsModule.java
index 1f66b84..dbdec6b 100644
--- a/packages/SystemUI/src/com/android/systemui/plugins/PluginsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/plugins/PluginsModule.java
@@ -21,9 +21,9 @@
import android.content.pm.PackageManager;
import android.os.Build;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.PluginModule;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import com.android.systemui.shared.plugins.PluginActionManager;
import com.android.systemui.shared.plugins.PluginEnabler;
import com.android.systemui.shared.plugins.PluginInstance;
@@ -33,6 +33,10 @@
import com.android.systemui.util.concurrency.GlobalConcurrencyModule;
import com.android.systemui.util.concurrency.ThreadFactory;
+import dagger.Binds;
+import dagger.Module;
+import dagger.Provides;
+
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executor;
@@ -40,10 +44,6 @@
import javax.inject.Named;
import javax.inject.Singleton;
-import dagger.Binds;
-import dagger.Module;
-import dagger.Provides;
-
/**
* Dagger Module for code related to plugins.
*
diff --git a/packages/SystemUI/src/com/android/systemui/power/dagger/PowerModule.java b/packages/SystemUI/src/com/android/systemui/power/dagger/PowerModule.java
index 8dd0ea0..b889f8e 100644
--- a/packages/SystemUI/src/com/android/systemui/power/dagger/PowerModule.java
+++ b/packages/SystemUI/src/com/android/systemui/power/dagger/PowerModule.java
@@ -30,7 +30,6 @@
import dagger.multibindings.IntoMap;
import dagger.multibindings.IntoSet;
-
/** Dagger Module for code in the power package. */
@Module(
includes = {
diff --git a/packages/SystemUI/src/com/android/systemui/process/condition/SystemProcessCondition.java b/packages/SystemUI/src/com/android/systemui/process/condition/SystemProcessCondition.java
index b6a5ad6..694b525 100644
--- a/packages/SystemUI/src/com/android/systemui/process/condition/SystemProcessCondition.java
+++ b/packages/SystemUI/src/com/android/systemui/process/condition/SystemProcessCondition.java
@@ -20,10 +20,10 @@
import com.android.systemui.process.ProcessWrapper;
import com.android.systemui.shared.condition.Condition;
-import javax.inject.Inject;
-
import kotlinx.coroutines.CoroutineScope;
+import javax.inject.Inject;
+
/**
* {@link SystemProcessCondition} checks to make sure the current process is being ran by the
* System User.
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java
index ffbd06f..d715f42 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterViewController.java
@@ -23,10 +23,10 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.qs.dagger.QSScope;
+import com.android.systemui.res.R;
import com.android.systemui.retail.domain.interactor.RetailModeInteractor;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.ViewController;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSScrollLayout.java b/packages/SystemUI/src/com/android/systemui/qs/QSScrollLayout.java
index 77a5ce3..dc83201 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSScrollLayout.java
@@ -26,9 +26,9 @@
import androidx.core.widget.NestedScrollView;
-import com.android.systemui.res.R;
import com.android.systemui.qs.touch.OverScroll;
import com.android.systemui.qs.touch.SwipeDetector;
+import com.android.systemui.res.R;
/**
* Quick setting scroll view containing the brightness slider and the QS tiles.
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 6c32ed3..168be40 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -25,8 +25,8 @@
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.FontSizeUtils;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.qs.QSTile;
+import com.android.systemui.res.R;
/**
* Version of QSPanel that only shows N Quick Tiles in the QS Header.
diff --git a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
index a1b617f..7cb950b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
@@ -24,11 +24,11 @@
import com.android.systemui.flags.Flags;
import com.android.systemui.util.settings.GlobalSettings;
-import javax.inject.Named;
-
import dagger.Module;
import dagger.Provides;
+import javax.inject.Named;
+
@Module
public interface QSFlagsModule {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/QSTileServiceWrapper.java b/packages/SystemUI/src/com/android/systemui/qs/external/QSTileServiceWrapper.java
index 83b6f0d..c302ee2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/QSTileServiceWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/QSTileServiceWrapper.java
@@ -21,7 +21,6 @@
import androidx.annotation.NonNull;
-
public class QSTileServiceWrapper {
private static final String TAG = "IQSTileServiceWrapper";
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java
index 3ee4a1b..f8bf0a6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java
@@ -31,11 +31,9 @@
import androidx.annotation.VisibleForTesting;
-import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.qs.external.TileLifecycleManager.TileChangeListener;
import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedRepository;
import com.android.systemui.settings.UserTracker;
-import com.android.systemui.util.concurrency.DelayableExecutor;
import java.util.List;
import java.util.Objects;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
index bdcbac0..b929c43 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
@@ -25,13 +25,13 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.external.CustomTile;
+import dagger.Lazy;
+
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Provider;
-import dagger.Lazy;
-
/**
* A factory that creates Quick Settings tiles based on a tileSpec
*
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CameraToggleTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CameraToggleTile.java
index 736f035..6502a42 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CameraToggleTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CameraToggleTile.java
@@ -31,7 +31,6 @@
import androidx.annotation.NonNull;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -40,6 +39,7 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
index c15289f..1a8530f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
@@ -28,8 +28,8 @@
import com.android.settingslib.Utils;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.FontSizeUtils;
-import com.android.systemui.res.R;
import com.android.systemui.qs.DataUsageGraph;
+import com.android.systemui.res.R;
import java.text.DecimalFormat;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
index 9fab51f..f022981 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
@@ -29,7 +29,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -40,6 +39,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.FlashlightController;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index 9ee417e..4d0404d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -33,7 +33,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settingslib.wifi.WifiEnterpriseRestrictionUtils;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -44,6 +43,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DataSaverController;
import com.android.systemui.statusbar.policy.HotspotController;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
index 24b2d8a..0f260e3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
@@ -41,7 +41,6 @@
import com.android.settingslib.graph.SignalDrawable;
import com.android.settingslib.mobile.TelephonyIcons;
import com.android.settingslib.net.DataUsageController;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -53,6 +52,7 @@
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.qs.tiles.dialog.InternetDialogManager;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.connectivity.AccessPointController;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
index 9ddcf295..b3f0d8b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
@@ -29,7 +29,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -41,6 +40,7 @@
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.pipeline.domain.interactor.PanelInteractor;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.LocationController.LocationChangeCallback;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/MicrophoneToggleTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/MicrophoneToggleTile.java
index 92338cb..36f3dc7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/MicrophoneToggleTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/MicrophoneToggleTile.java
@@ -31,7 +31,6 @@
import androidx.annotation.NonNull;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -40,6 +39,7 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
index a239c28..d650f73 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
@@ -34,7 +34,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
@@ -46,6 +45,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
index 7e0fa07..a1ea46d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
@@ -36,7 +36,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.NightDisplayListenerModule;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
@@ -48,6 +47,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.LocationController;
import java.text.DateFormat;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
index b9d902a..76ada10 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
@@ -30,7 +30,6 @@
import com.android.internal.R;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R.drawable;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -42,6 +41,7 @@
import com.android.systemui.qs.ReduceBrightColorsController;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R.drawable;
import javax.inject.Inject;
import javax.inject.Named;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java
index 300cc56..d92873ada 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java
@@ -31,7 +31,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -42,6 +41,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.LocationController;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WorkModeTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WorkModeTile.java
index 7a9384a..abc4812 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WorkModeTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WorkModeTile.java
@@ -32,7 +32,6 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
@@ -43,6 +42,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.ManagedProfileController;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt
index c1986fa..22146ce 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+@file:OptIn(ExperimentalCoroutinesApi::class)
+
package com.android.systemui.qs.ui.viewmodel
import androidx.lifecycle.LifecycleOwner
@@ -30,7 +32,7 @@
import com.android.systemui.qs.FooterActionsController
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
import com.android.systemui.qs.ui.adapter.QSSceneAdapter
-import com.android.systemui.scene.domain.interactor.SceneInteractor
+import com.android.systemui.scene.domain.interactor.SceneBackInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.settings.brightness.ui.viewModel.BrightnessMirrorViewModel
import com.android.systemui.shade.ui.viewmodel.ShadeHeaderViewModel
@@ -42,6 +44,8 @@
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.filter
+import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
/** Models UI state and handles user input for the quick settings scene. */
@@ -57,21 +61,30 @@
val notifications: NotificationsPlaceholderViewModel,
private val footerActionsViewModelFactory: FooterActionsViewModel.Factory,
private val footerActionsController: FooterActionsController,
- sceneInteractor: SceneInteractor,
+ sceneBackInteractor: SceneBackInteractor,
) {
- @OptIn(ExperimentalCoroutinesApi::class)
+ private val backScene: StateFlow<SceneKey> =
+ sceneBackInteractor.backScene
+ .filter { it != Scenes.QuickSettings }
+ .map { it ?: Scenes.Shade }
+ .stateIn(
+ scope = applicationScope,
+ started = SharingStarted.WhileSubscribed(),
+ initialValue = Scenes.Shade,
+ )
+
val destinationScenes: StateFlow<Map<UserAction, UserActionResult>> =
combine(
deviceEntryInteractor.isUnlocked,
deviceEntryInteractor.canSwipeToEnter,
qsSceneAdapter.isCustomizing,
- sceneInteractor.previousScene(ignored = Scenes.QuickSettings),
- ) { isUnlocked, canSwipeToDismiss, isCustomizing, previousScene ->
+ backScene,
+ ) { isUnlocked, canSwipeToDismiss, isCustomizing, backScene ->
destinationScenes(
isUnlocked,
canSwipeToDismiss,
isCustomizing,
- previousScene,
+ backScene,
)
}
.stateIn(
@@ -82,8 +95,7 @@
isUnlocked = deviceEntryInteractor.isUnlocked.value,
canSwipeToDismiss = deviceEntryInteractor.canSwipeToEnter.value,
isCustomizing = qsSceneAdapter.isCustomizing.value,
- previousScene = sceneInteractor
- .previousScene(ignored = Scenes.QuickSettings).value,
+ backScene = backScene.value,
),
)
@@ -91,7 +103,7 @@
isUnlocked: Boolean,
canSwipeToDismiss: Boolean?,
isCustomizing: Boolean,
- previousScene: SceneKey?
+ backScene: SceneKey?,
): Map<UserAction, UserActionResult> {
val upBottomEdge =
when {
@@ -108,13 +120,15 @@
// TODO(b/330200163) Add an Up from Bottom to be able to collapse the shade
// while customizing
} else {
- this[Back] = UserActionResult(previousScene ?: Scenes.Shade)
- this[Swipe(SwipeDirection.Up)] = UserActionResult(previousScene ?: Scenes.Shade)
- this[
+ put(Back, UserActionResult(backScene ?: Scenes.Shade))
+ put(Swipe(SwipeDirection.Up), UserActionResult(backScene ?: Scenes.Shade))
+ put(
Swipe(
fromSource = Edge.Bottom,
direction = SwipeDirection.Up,
- )] = UserActionResult(upBottomEdge)
+ ),
+ UserActionResult(upBottomEdge),
+ )
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 520331a..b92e8eb 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -253,8 +253,21 @@
@Override
public void onStatusBarTrackpadEvent(MotionEvent event) {
- verifyCallerAndClearCallingIdentityPostMain("onStatusBarTrackpadEvent", () ->
- mShadeViewControllerLazy.get().handleExternalTouch(event));
+ verifyCallerAndClearCallingIdentityPostMain("onStatusBarTrackpadEvent", () -> {
+ if (SceneContainerFlag.isEnabled()) {
+ int action = event.getActionMasked();
+ if (action == ACTION_DOWN) {
+ mSceneInteractor.get().onRemoteUserInteractionStarted(
+ "trackpad swipe");
+ } else if (action == ACTION_UP) {
+ mSceneInteractor.get().changeScene(
+ Scenes.Shade, "short trackpad swipe");
+ }
+ mStatusBarWinController.getWindowRootView().dispatchTouchEvent(event);
+ } else {
+ mShadeViewControllerLazy.get().handleExternalTouch(event);
+ }
+ });
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt b/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt
index 8277c73..2a73b53 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/KeyguardlessSceneContainerFrameworkModule.kt
@@ -47,6 +47,12 @@
Scenes.Shade,
),
initialSceneKey = Scenes.Gone,
+ navigationDistances =
+ mapOf(
+ Scenes.Gone to 0,
+ Scenes.Shade to 1,
+ Scenes.QuickSettings to 2,
+ ),
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt b/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt
index 69f9443..cd1b965 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/SceneContainerFrameworkModule.kt
@@ -73,6 +73,15 @@
Scenes.Shade,
),
initialSceneKey = Scenes.Lockscreen,
+ navigationDistances =
+ mapOf(
+ Scenes.Gone to 0,
+ Scenes.Lockscreen to 0,
+ Scenes.Communal to 1,
+ Scenes.Shade to 2,
+ Scenes.QuickSettings to 3,
+ Scenes.Bouncer to 4,
+ ),
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/ShadelessSceneContainerFrameworkModule.kt b/packages/SystemUI/src/com/android/systemui/scene/ShadelessSceneContainerFrameworkModule.kt
index d202c24..b918277 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/ShadelessSceneContainerFrameworkModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/ShadelessSceneContainerFrameworkModule.kt
@@ -47,6 +47,11 @@
Scenes.Bouncer,
),
initialSceneKey = Scenes.Lockscreen,
+ mapOf(
+ Scenes.Gone to 0,
+ Scenes.Lockscreen to 0,
+ Scenes.Bouncer to 1,
+ )
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/data/repository/SceneContainerRepository.kt b/packages/SystemUI/src/com/android/systemui/scene/data/repository/SceneContainerRepository.kt
index 3082eb9..994b012 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/data/repository/SceneContainerRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/data/repository/SceneContainerRepository.kt
@@ -24,8 +24,6 @@
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.scene.shared.model.SceneContainerConfig
import com.android.systemui.scene.shared.model.SceneDataSource
-import com.android.systemui.util.kotlin.WithPrev
-import com.android.systemui.util.kotlin.pairwise
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -36,7 +34,6 @@
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
-import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
/** Source of truth for scene framework application state. */
@@ -47,32 +44,7 @@
private val config: SceneContainerConfig,
private val dataSource: SceneDataSource,
) {
- private val previousAndCurrentScene: StateFlow<WithPrev<SceneKey?, SceneKey>> =
- dataSource.currentScene
- .pairwise()
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
- initialValue = WithPrev(null, dataSource.currentScene.value),
- )
-
- val currentScene: StateFlow<SceneKey> =
- previousAndCurrentScene
- .map { it.newValue }
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
- initialValue = previousAndCurrentScene.value.newValue,
- )
-
- val previousScene: StateFlow<SceneKey?> =
- previousAndCurrentScene
- .map { it.previousValue }
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
- initialValue = previousAndCurrentScene.value.previousValue,
- )
+ val currentScene: StateFlow<SceneKey> = dataSource.currentScene
private val _isVisible = MutableStateFlow(true)
val isVisible: StateFlow<Boolean> = _isVisible.asStateFlow()
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt
new file mode 100644
index 0000000..f66d08f
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.scene.domain.interactor
+
+import com.android.compose.animation.scene.SceneKey
+import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.scene.shared.logger.SceneLogger
+import com.android.systemui.scene.shared.model.SceneContainerConfig
+import java.util.Stack
+import javax.inject.Inject
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+
+@SysUISingleton
+class SceneBackInteractor
+@Inject
+constructor(
+ private val logger: SceneLogger,
+ private val sceneContainerConfig: SceneContainerConfig,
+) {
+ private val _backScene = MutableStateFlow<SceneKey?>(null)
+ /**
+ * The scene to navigate to when the user triggers back navigation.
+ *
+ * This is meant for scene implementations to consult with when they implement their destination
+ * scene flow.
+ *
+ * Note that this flow could emit any scene from the [SceneContainerConfig] and that it's an
+ * illegal state to have scene implementation map to itself in its destination scene flow. Thus,
+ * scene implementations might wish to filter their own scene key out before using this.
+ */
+ val backScene: StateFlow<SceneKey?> = _backScene.asStateFlow()
+
+ private val backStack = Stack<SceneKey>()
+
+ fun onSceneChange(from: SceneKey, to: SceneKey) {
+ check(from != to) { "from == to, from=${from.debugName}, to=${to.debugName}" }
+ when (stackOperation(from, to)) {
+ Clear -> {
+ backStack.clear()
+ }
+ Push -> {
+ backStack.push(from)
+ }
+ Pop -> {
+ check(backStack.isNotEmpty()) { "Cannot pop ${from.debugName} when stack is empty" }
+ val popped = backStack.pop()
+ check(to == popped) {
+ "Expected to pop ${to.debugName} but instead popped ${popped.debugName}"
+ }
+ }
+ }
+
+ logger.logSceneBackStack(backStack)
+ _backScene.value = peek()
+ }
+
+ private fun stackOperation(from: SceneKey, to: SceneKey): StackOperation {
+ val fromDistance =
+ checkNotNull(sceneContainerConfig.navigationDistances[from]) {
+ "No distance mapping for scene \"${from.debugName}\"!"
+ }
+ val toDistance =
+ checkNotNull(sceneContainerConfig.navigationDistances[to]) {
+ "No distance mapping for scene \"${to.debugName}\"!"
+ }
+
+ return when {
+ toDistance == 0 -> Clear
+ toDistance > fromDistance -> Push
+ toDistance < fromDistance -> Pop
+ else ->
+ error(
+ "No mapping when from=${from.debugName} (distance=$fromDistance)," +
+ " to=${to.debugName} (distance=$toDistance)!"
+ )
+ }
+ }
+
+ private fun peek(): SceneKey? {
+ return if (backStack.isNotEmpty()) {
+ backStack.peek()
+ } else {
+ null
+ }
+ }
+
+ private sealed interface StackOperation
+ private data object Clear : StackOperation
+ private data object Push : StackOperation
+ private data object Pop : StackOperation
+}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt
index 8ced222..2ccd3b9 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt
@@ -140,33 +140,6 @@
)
/**
- * The previous scene (or `null` if the previous scene is the [ignored] scene).
- *
- * This is effectively the previous value of [currentScene] which means that all caveats, for
- * example regarding when in a transition the current scene changes, apply.
- *
- * @param ignored If the previous scene is the same as [ignored], `null` is emitted. This is
- * designed to reduce the chances of a scene using [previousScene] naively to then set up a
- * user action that ends up leading to itself, which is an illegal operation that would cause
- * a crash.
- */
- fun previousScene(
- ignored: SceneKey? = null,
- ): StateFlow<SceneKey?> {
- fun SceneKey?.nullifyIfIgnored(): SceneKey? {
- return this?.takeIf { this != ignored }
- }
-
- return repository.previousScene
- .map { it.nullifyIfIgnored() }
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
- initialValue = repository.previousScene.value.nullifyIfIgnored(),
- )
- }
-
- /**
* Returns the keys of all scenes in the container.
*
* The scenes will be sorted in z-order such that the last one is the one that should be
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
index 4fc24b8..39ec12f 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
@@ -45,6 +45,7 @@
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.FalsingManager.FalsingBeliefListener
import com.android.systemui.power.domain.interactor.PowerInteractor
+import com.android.systemui.scene.domain.interactor.SceneBackInteractor
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
@@ -56,6 +57,7 @@
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.policy.domain.interactor.DeviceProvisioningInteractor
import com.android.systemui.util.asIndenting
+import com.android.systemui.util.kotlin.pairwise
import com.android.systemui.util.kotlin.sample
import com.android.systemui.util.printSection
import com.android.systemui.util.println
@@ -111,6 +113,7 @@
private val faceUnlockInteractor: DeviceEntryFaceAuthInteractor,
private val shadeInteractor: ShadeInteractor,
private val uiEventLogger: UiEventLogger,
+ private val sceneBackInteractor: SceneBackInteractor,
) : CoreStartable {
override fun start() {
@@ -124,6 +127,7 @@
hydrateInteractionState()
handleBouncerOverscroll()
hydrateWindowController()
+ hydrateBackStack()
} else {
sceneLogger.logFrameworkEnabled(
isEnabled = false,
@@ -257,8 +261,7 @@
// Track the previous scene (sans Bouncer), so that we know where to go when the device
// is unlocked whilst on the bouncer.
val previousScene =
- sceneInteractor
- .previousScene()
+ sceneBackInteractor.backScene
.filterNot { it == Scenes.Bouncer }
.stateIn(this, SharingStarted.Eagerly, initialValue = null)
deviceUnlockedInteractor.deviceUnlockStatus
@@ -581,4 +584,12 @@
loggingReason = loggingReason,
)
}
+
+ private fun hydrateBackStack() {
+ applicationScope.launch {
+ sceneInteractor.currentScene.pairwise().collect { (from, to) ->
+ sceneBackInteractor.onSceneChange(from = from, to = to)
+ }
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt b/packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt
index f44779a..5ebdd86 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt
@@ -20,6 +20,7 @@
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.dagger.SceneFrameworkLog
+import java.util.Stack
import javax.inject.Inject
class SceneLogger @Inject constructor(@SceneFrameworkLog private val logBuffer: LogBuffer) {
@@ -102,7 +103,7 @@
tag = TAG,
level = LogLevel.INFO,
messageInitializer = { str1 = reason },
- messagePrinter = { "remote user interaction started, reason: $str3" },
+ messagePrinter = { "remote user interaction started, reason: $str1" },
)
}
@@ -115,6 +116,15 @@
)
}
+ fun logSceneBackStack(backStack: Stack<SceneKey>) {
+ logBuffer.log(
+ tag = TAG,
+ level = LogLevel.INFO,
+ messageInitializer = { str1 = backStack.joinToString(", ") { it.debugName } },
+ messagePrinter = { "back stack: $str1" },
+ )
+ }
+
companion object {
private const val TAG = "SceneFramework"
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneContainerConfig.kt b/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneContainerConfig.kt
index 53cdaaa..0a30c31 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneContainerConfig.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneContainerConfig.kt
@@ -25,6 +25,9 @@
* The keys to all scenes in the container, sorted by z-order such that the last one renders on
* top of all previous ones. Scene keys within the same container must not repeat but it's okay
* to have the same scene keys in different containers.
+ *
+ * Note that this doesn't control how back navigation works; for that, we have
+ * [navigationDistances].
*/
val sceneKeys: List<SceneKey>,
@@ -33,6 +36,24 @@
* before taking any application state in to account.
*/
val initialSceneKey: SceneKey,
+
+ /**
+ * Navigation distance of each scene.
+ *
+ * The navigation distance is a measure of how many non-back user action "steps" away from the
+ * starting scene, each scene is.
+ *
+ * The framework uses these to help scene implementations decide which scene to go back to when
+ * the user attempts to navigate back on them, if they need that.
+ *
+ * In general, the more non-back user actions are needed to get to a scene, the greater that
+ * scene's distance should be. Navigating "back" then goes from scenes with a higher distance to
+ * scenes with a lower distance.
+ *
+ * Note that this is not the z-order of rendering; that's determined by the order of declaration
+ * of scenes in the [sceneKeys] list.
+ */
+ val navigationDistances: Map<SceneKey, Int>
) {
init {
check(sceneKeys.isNotEmpty()) { "A container must have at least one scene key." }
@@ -40,5 +61,9 @@
check(sceneKeys.contains(initialSceneKey)) {
"The initial key \"$initialSceneKey\" is not present in this container."
}
+
+ check(navigationDistances.keys == sceneKeys.toSet()) {
+ "Scene keys and distance map must match."
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/OverlayActionChip.java b/packages/SystemUI/src/com/android/systemui/screenshot/OverlayActionChip.java
index 30f5e8b..9e68c48 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/OverlayActionChip.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/OverlayActionChip.java
@@ -32,7 +32,6 @@
import com.android.systemui.res.R;
-
/**
* View for a chip with an icon and text.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
index 501a4a7..494fc9b 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
@@ -97,7 +97,6 @@
import javax.inject.Provider;
-
/**
* Controls the state and flow for screenshots.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/SmartActionsReceiver.java b/packages/SystemUI/src/com/android/systemui/screenshot/SmartActionsReceiver.java
index ef58b9d..f8b22a6 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/SmartActionsReceiver.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/SmartActionsReceiver.java
@@ -31,7 +31,6 @@
import javax.inject.Inject;
-
/**
* Executes the smart action tapped by the user in the notification.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsService.java b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsService.java
index c89b476..3bca4e4 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsService.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsService.java
@@ -38,9 +38,9 @@
import androidx.annotation.Nullable;
import com.android.internal.statusbar.IAppClipsService;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.res.R;
import com.android.wm.shell.bubbles.Bubbles;
import java.util.Optional;
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivity.java b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivity.java
index a31b301..48449b3 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivity.java
@@ -48,13 +48,13 @@
import com.android.internal.infra.ServiceConnector;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IAppClipsService;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastSender;
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.notetask.NoteTaskController;
import com.android.systemui.notetask.NoteTaskEntryPoint;
+import com.android.systemui.res.R;
import java.util.concurrent.Executor;
diff --git a/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java b/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java
index 20bd7c6..49f3cfc 100644
--- a/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java
+++ b/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java
@@ -44,7 +44,6 @@
import java.util.concurrent.Executor;
-
/**
* A view which can draw a scrim. This view maybe be used in multiple windows running on different
* threads, but is controlled by {@link com.android.systemui.statusbar.phone.ScrimController} so we
diff --git a/packages/SystemUI/src/com/android/systemui/settings/MultiUserUtilsModule.java b/packages/SystemUI/src/com/android/systemui/settings/MultiUserUtilsModule.java
index fd807db..05f19ef 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/MultiUserUtilsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/MultiUserUtilsModule.java
@@ -36,11 +36,11 @@
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;
-import javax.inject.Provider;
-
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineScope;
+import javax.inject.Provider;
+
/**
* Dagger Module for classes found within the com.android.systemui.settings package.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index aa915e3..67211b1 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -242,6 +242,9 @@
import kotlin.Unit;
+import kotlinx.coroutines.CoroutineDispatcher;
+import kotlinx.coroutines.flow.Flow;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
@@ -251,9 +254,6 @@
import javax.inject.Inject;
import javax.inject.Provider;
-import kotlinx.coroutines.CoroutineDispatcher;
-import kotlinx.coroutines.flow.Flow;
-
@SysUISingleton
public final class NotificationPanelViewController implements ShadeSurface, Dumpable {
diff --git a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
index c429329..e3d2f7d 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
@@ -39,11 +39,11 @@
import com.android.keyguard.CarrierTextManager;
import com.android.settingslib.AccessibilityContentDescriptions;
import com.android.settingslib.mobile.TelephonyIcons;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java
index 8d9fab1..d278b3e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java
@@ -26,14 +26,13 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.keyguard.AlphaOptimizedLinearLayout;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.DarkIconDispatcher;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry.OnSensitivityChangedListener;
import java.util.ArrayList;
-
/**
* The view in the statusBar that contains part of the heads-up information
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
index 0091bc5..854ef92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
@@ -33,7 +33,6 @@
import android.annotation.UserIdInt;
import android.app.ActivityOptions;
import android.app.KeyguardManager;
-import android.app.Notification;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -65,7 +64,6 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlagsClassic;
-import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.recents.OverviewProxyService;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
index 6e7d8f4..0d789c7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameViewController.java
@@ -34,10 +34,10 @@
import com.android.systemui.util.ViewController;
import com.android.systemui.util.kotlin.JavaAdapter;
-import javax.inject.Inject;
-
import kotlinx.coroutines.Job;
+import javax.inject.Inject;
+
/** Controller for {@link OperatorNameView}. */
public class OperatorNameViewController extends ViewController<OperatorNameView> {
private static final String KEY_SHOW_OPERATOR_NAME = "show_operator_name";
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
index 1638780..5391992 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/CallbackHandler.java
@@ -32,7 +32,6 @@
import javax.inject.Inject;
-
/**
* Implements network listeners and forwards the calls along onto other listeners but on
* the current or specified Looper.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalController.java
index 7e8f04e..2d2ee4a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalController.java
@@ -29,7 +29,6 @@
import java.util.BitSet;
import java.util.List;
-
/**
* Common base class for handling signal for both wifi and mobile data.
*
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
index 08defcc..0e572be 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
@@ -34,8 +34,8 @@
import com.android.settingslib.graph.SignalDrawable;
import com.android.settingslib.mobile.TelephonyIcons;
import com.android.settingslib.wifi.WifiStatusTracker;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
+import com.android.systemui.res.R;
import java.io.PrintWriter;
import java.util.BitSet;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index ad9e312..5bbd77e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -49,10 +49,10 @@
import com.android.internal.messages.nano.SystemMessageProto;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.systemui.CoreStartable;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.UiBackground;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.policy.KeyguardStateController;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 8b673c9..b397906 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -71,14 +71,14 @@
import com.android.systemui.statusbar.notification.stack.PriorityBucket;
import com.android.systemui.util.ListenerSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
/**
* Represents a notification that the system UI knows about
*
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinator.java
index 0c95eab..7251607 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinator.java
@@ -16,10 +16,8 @@
package com.android.systemui.statusbar.notification.collection.coordinator;
-import android.Manifest;
import android.app.Notification;
import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.service.notification.StatusBarNotification;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
index e31e9c2..91bb28e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
@@ -87,16 +87,18 @@
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
import com.android.systemui.statusbar.policy.HeadsUpManager;
-import javax.inject.Provider;
-
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;
+
import kotlin.coroutines.CoroutineContext;
+
import kotlinx.coroutines.CoroutineScope;
+import javax.inject.Provider;
+
/**
* Dagger Module for classes found within the com.android.systemui.statusbar.notification package.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java
index 6c63d1d..89aa3ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationPanelLogger.java
@@ -33,6 +33,7 @@
import com.android.systemui.statusbar.notification.stack.PriorityBucket;
import java.util.List;
+
/**
* Statsd logging for notification panel.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
index a317f95..c10c09c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
@@ -41,8 +41,8 @@
import com.android.app.animation.Interpolators;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.AlphaOptimizedImageView;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java
index 53f7d4b..60e98a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PartialConversationInfo.java
@@ -37,8 +37,6 @@
import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import java.util.Set;
-
/**
* The guts of a conversation notification that doesn't use valid shortcuts that is revealed when
* performing a long press.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt
index d3c874c..3fce9ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflater.kt
@@ -217,8 +217,9 @@
var currentGroup: MutableList<MessagingStyle.Message>? = null
var currentSenderKey: CharSequence? = null
val groups = mutableListOf<MutableList<MessagingStyle.Message>>()
- for (i in 0 until (historicMessages.size + messages.size)) {
- val message = if (i < historicMessages.size) historicMessages[i] else messages[i]
+ val histSize = historicMessages.size
+ for (i in 0 until (histSize + messages.size)) {
+ val message = if (i < histSize) historicMessages[i] else messages[i - histSize]
val sender = message.senderPerson
val senderKey = sender?.getKeyOrName()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
index 91b12cc..df43ff1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
@@ -41,8 +41,8 @@
import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.NotificationActionListLayout;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.UiOffloadThread;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.ViewTransformationHelper;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
index ab62ed6..5963d35 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
@@ -29,7 +29,6 @@
import com.android.app.animation.Interpolators;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.keyguard.KeyguardSliceView;
import com.android.systemui.res.R;
import com.android.systemui.shared.clocks.AnimatableClockView;
import com.android.systemui.statusbar.NotificationShelf;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
index eb81c46..1358cfd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java
@@ -30,7 +30,6 @@
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
-import com.android.systemui.dump.DumpManager;
import com.android.systemui.statusbar.AutoHideUiElement;
import java.io.PrintWriter;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
index d513f8d..398c1d4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
@@ -14,8 +14,8 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.plugins.DarkIconDispatcher.getTint;
import static com.android.settingslib.flags.Flags.newStatusBarIcons;
+import static com.android.systemui.plugins.DarkIconDispatcher.getTint;
import android.animation.ArgbEvaluator;
import android.content.Context;
@@ -28,16 +28,16 @@
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-import javax.inject.Inject;
-
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+
/**
*/
@SysUISingleton
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
index 033659b..3063aed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -57,12 +57,12 @@
import dagger.Lazy;
+import kotlinx.coroutines.ExperimentalCoroutinesApi;
+
import java.util.ArrayList;
import javax.inject.Inject;
-import kotlinx.coroutines.ExperimentalCoroutinesApi;
-
/**
* Implementation of DozeHost for SystemUI.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 8ec8d1c..68457ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -58,6 +58,11 @@
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;
+import kotlinx.coroutines.flow.Flow;
+import kotlinx.coroutines.flow.MutableStateFlow;
+import kotlinx.coroutines.flow.StateFlow;
+import kotlinx.coroutines.flow.StateFlowKt;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -68,11 +73,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.flow.Flow;
-import kotlinx.coroutines.flow.MutableStateFlow;
-import kotlinx.coroutines.flow.StateFlow;
-import kotlinx.coroutines.flow.StateFlowKt;
-
/** A implementation of HeadsUpManager for phone. */
@SysUISingleton
public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardDismissHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardDismissHandler.java
index f043fcf..abfe6a2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardDismissHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardDismissHandler.java
@@ -18,7 +18,6 @@
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
-
/** Executes actions that require the screen to be unlocked. */
public interface KeyguardDismissHandler {
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java
index c6690c9..c4e0f31 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java
@@ -32,8 +32,8 @@
import com.android.app.animation.Interpolators;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.res.R;
import com.android.systemui.keyguard.KeyguardIndication;
+import com.android.systemui.res.R;
/**
* A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open").
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index 302bdcc..c055a82 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -52,14 +52,14 @@
import com.android.systemui.user.ui.binder.StatusBarUserChipViewBinder;
import com.android.systemui.user.ui.viewmodel.StatusBarUserChipViewModel;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
/**
* The header group on Keyguard.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
index 3343779..03a6f62 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java
@@ -19,8 +19,8 @@
import static android.app.StatusBarManager.DISABLE2_SYSTEM_ICONS;
import static android.app.StatusBarManager.DISABLE_SYSTEM_INFO;
-import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.Flags.updateUserSwitcherBackground;
+import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import android.content.res.Configuration;
import android.content.res.Resources;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index d975009..44acb07 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -44,7 +44,6 @@
import androidx.lifecycle.Observer;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.dagger.qualifiers.Main;
@@ -56,6 +55,7 @@
import com.android.systemui.privacy.logging.PrivacyLogger;
import com.android.systemui.qs.tiles.DndTile;
import com.android.systemui.qs.tiles.RotationLockTile;
+import com.android.systemui.res.R;
import com.android.systemui.screenrecord.RecordingController;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 02293a2..0a88d63 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -83,6 +83,8 @@
import com.android.systemui.util.wakelock.WakeLock;
import com.android.systemui.wallpapers.data.repository.WallpaperRepository;
+import kotlinx.coroutines.CoroutineDispatcher;
+
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -91,8 +93,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.CoroutineDispatcher;
-
/**
* Controls both the scrim behind the notifications and in front of the notifications (when a
* security method gets shown).
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index a141b53..f35d199 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -108,6 +108,10 @@
import kotlin.Unit;
+import kotlinx.coroutines.CoroutineDispatcher;
+import kotlinx.coroutines.ExperimentalCoroutinesApi;
+import kotlinx.coroutines.Job;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -117,10 +121,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.CoroutineDispatcher;
-import kotlinx.coroutines.ExperimentalCoroutinesApi;
-import kotlinx.coroutines.Job;
-
/**
* Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back
* via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 5d27467..e1a7f22 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -90,7 +90,6 @@
import javax.inject.Inject;
-
/**
* Status bar implementation of {@link NotificationActivityStarter}.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
index 703b3c6..ac6783f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
@@ -23,8 +23,8 @@
import android.util.Log;
import com.android.settingslib.mobile.TelephonyIcons;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SysuiDarkIconDispatcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SysuiDarkIconDispatcher.java
index 93db916..82f9eba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SysuiDarkIconDispatcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SysuiDarkIconDispatcher.java
@@ -21,11 +21,11 @@
import com.android.systemui.Dumpable;
import com.android.systemui.plugins.DarkIconDispatcher;
+import kotlinx.coroutines.flow.StateFlow;
+
import java.util.ArrayList;
import java.util.Collection;
-import kotlinx.coroutines.flow.StateFlow;
-
/**
* Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area
* and dark intensity.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
index c52132f..2ce710c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
@@ -81,6 +81,8 @@
import kotlin.Unit;
+import kotlinx.coroutines.DisposableHandle;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
@@ -91,8 +93,6 @@
import javax.inject.Inject;
-import kotlinx.coroutines.DisposableHandle;
-
/**
* Contains the collapsed status bar and handles hiding/showing based on disable flags
* and keyguard state. Also manages lifecycle to make sure the views it contains are being
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
index 20e44e7..885abca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
@@ -322,11 +322,6 @@
wifiManager.registerTrafficStateCallback(mainExecutor, callback)
awaitClose { wifiManager.unregisterTrafficStateCallback(callback) }
}
- .logDiffsForTable(
- tableLogger,
- columnPrefix = ACTIVITY_PREFIX,
- initialValue = ACTIVITY_DEFAULT,
- )
.stateIn(
scope,
started = SharingStarted.WhileSubscribed(),
@@ -441,7 +436,6 @@
private const val WIFI_STATE_DEFAULT = WifiManager.WIFI_STATE_DISABLED
- private const val ACTIVITY_PREFIX = "wifiActivity"
val ACTIVITY_DEFAULT = DataActivityModel(hasActivityIn = false, hasActivityOut = false)
private const val TAG = "WifiTrackerLibInputLog"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
index 149c8fa..64bdf60 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java
@@ -48,7 +48,6 @@
import javax.inject.Inject;
-
/** Platform implementation of the cast controller. **/
@SysUISingleton
public class CastControllerImpl implements CastController {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index 20d1fff..a25f8e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -48,11 +48,11 @@
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.FontSizeUtils;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.demomode.DemoModeCommandReceiver;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBarIconController;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
index 74e02d7..7e6e00e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
@@ -29,8 +29,8 @@
import android.widget.TextView;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
+import com.android.systemui.res.R;
import java.util.Date;
import java.util.Locale;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index 4b97197..d0cc32b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -32,11 +32,11 @@
import androidx.annotation.NonNull;
import com.android.internal.util.ConcurrentUtils;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import java.io.PrintWriter;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
index ad2b070..b07aa81 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
@@ -18,7 +18,6 @@
import android.app.IActivityTaskManager;
-import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserDetailItemView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserDetailItemView.java
index 012408e..3eeb59d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserDetailItemView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserDetailItemView.java
@@ -26,8 +26,8 @@
import com.android.app.animation.Interpolators;
import com.android.keyguard.KeyguardConstants;
-import com.android.systemui.res.R;
import com.android.systemui.qs.tiles.UserDetailItemView;
+import com.android.systemui.res.R;
/**
* Displays a user on the keyguard user switcher.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
index bf33473..8daa518 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
@@ -19,16 +19,15 @@
import android.app.RemoteInput;
import android.content.Context;
import android.content.res.Resources;
-import android.os.Handler;
import android.provider.DeviceConfig;
import android.text.TextUtils;
import android.util.KeyValueListParser;
import android.util.Log;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import com.android.systemui.util.DeviceConfigProxy;
import java.util.concurrent.Executor;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoControllerImpl.java
index 2ed9d15..712bab0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoControllerImpl.java
@@ -36,9 +36,9 @@
import com.android.internal.util.UserIcons;
import com.android.settingslib.drawable.UserIconDrawable;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeModule.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeModule.java
index e78eba4..0cd917f 100644
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeModule.java
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeModule.java
@@ -18,15 +18,15 @@
import android.content.res.Resources;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import com.android.systemui.util.concurrency.SysUIConcurrencyModule;
-import javax.inject.Named;
-
import dagger.Module;
import dagger.Provides;
+import javax.inject.Named;
+
/** */
@Module(includes = {SysUIConcurrencyModule.class})
public class ThemeModule {
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
index a43524a..68918ef 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java
@@ -29,10 +29,10 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.res.R;
import com.android.systemui.demomode.DemoMode;
import com.android.systemui.demomode.DemoModeAvailabilityTracker;
import com.android.systemui.demomode.DemoModeController;
+import com.android.systemui.res.R;
import com.android.systemui.util.settings.GlobalSettings;
public class DemoModeFragment extends PreferenceFragment implements OnPreferenceChangeListener {
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java
index 799e5af..ab2a7c7 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/LockscreenFragment.java
@@ -41,8 +41,8 @@
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.ScalingDrawableWrapper;
import com.android.systemui.statusbar.phone.ExpandableIndicator;
import com.android.systemui.statusbar.policy.ExtensionController.TunerFactory;
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/PluginFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/PluginFragment.java
index 7635a84..c7b848c 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/PluginFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/PluginFragment.java
@@ -36,9 +36,9 @@
import com.android.internal.util.ArrayUtils;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.PluginEnablerImpl;
import com.android.systemui.plugins.PluginManager;
+import com.android.systemui.res.R;
import com.android.systemui.shared.plugins.PluginActionManager;
import com.android.systemui.shared.plugins.PluginEnabler;
import com.android.systemui.shared.plugins.PluginPrefs;
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/RadioListPreference.java b/packages/SystemUI/src/com/android/systemui/tuner/RadioListPreference.java
index 20ce230..50ed3ef 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/RadioListPreference.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/RadioListPreference.java
@@ -29,8 +29,8 @@
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.fragments.FragmentService;
+import com.android.systemui.res.R;
import java.util.Objects;
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
index 14d7281..2135817 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java
@@ -30,9 +30,9 @@
import androidx.preference.PreferenceScreen;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.fragments.FragmentService;
+import com.android.systemui.res.R;
import com.android.systemui.util.settings.GlobalSettings;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
index 550a65c..fd0f7cb 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java
@@ -38,11 +38,11 @@
import com.android.internal.util.ArrayUtils;
import com.android.systemui.DejankUtils;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.qs.QSHost;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.SystemUIDialog;
@@ -56,7 +56,6 @@
import javax.inject.Inject;
-
/**
* @deprecated Don't use this class to listen to Secure Settings. Use {@code SecureSettings} instead
* or {@code SettingsObserver} to be able to specify the handler.
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
index e4f1c87..42563fd 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java
@@ -39,8 +39,8 @@
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
index ea871be..64e35d9 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingSecondaryUserActivity.java
@@ -34,8 +34,8 @@
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
-import com.android.systemui.res.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/user/CreateUserActivity.java b/packages/SystemUI/src/com/android/systemui/user/CreateUserActivity.java
index 562feb2e..56b46624 100644
--- a/packages/SystemUI/src/com/android/systemui/user/CreateUserActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/user/CreateUserActivity.java
@@ -33,8 +33,8 @@
import com.android.internal.logging.UiEventLogger;
import com.android.settingslib.users.CreateUserDialogController;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.res.R;
import javax.inject.Inject;
diff --git a/packages/SystemUI/src/com/android/systemui/util/annotations/WeaklyReferencedCallback.java b/packages/SystemUI/src/com/android/systemui/util/annotations/WeaklyReferencedCallback.java
index 855bba6..574e331 100644
--- a/packages/SystemUI/src/com/android/systemui/util/annotations/WeaklyReferencedCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/util/annotations/WeaklyReferencedCallback.java
@@ -22,7 +22,6 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
/**
* Descriptive annotation for clearly tagging callback types that are weakly
* referenced during registration.
diff --git a/packages/SystemUI/src/com/android/systemui/util/concurrency/GlobalConcurrencyModule.java b/packages/SystemUI/src/com/android/systemui/util/concurrency/GlobalConcurrencyModule.java
index e40d276..ecf1165 100644
--- a/packages/SystemUI/src/com/android/systemui/util/concurrency/GlobalConcurrencyModule.java
+++ b/packages/SystemUI/src/com/android/systemui/util/concurrency/GlobalConcurrencyModule.java
@@ -23,15 +23,15 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.UiBackground;
+import dagger.Binds;
+import dagger.Module;
+import dagger.Provides;
+
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import javax.inject.Singleton;
-import dagger.Binds;
-import dagger.Module;
-import dagger.Provides;
-
/**
* Dagger Module for classes found within the concurrent package.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/util/kotlin/Parallel.kt b/packages/SystemUI/src/com/android/systemui/util/kotlin/Parallel.kt
new file mode 100644
index 0000000..a47a2d6
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/util/kotlin/Parallel.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.util.kotlin
+
+import kotlinx.coroutines.CoroutineStart
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+
+/** Like [Iterable.flatMap] but executes each [transform] invocation in a separate coroutine. */
+suspend fun <A, B> Iterable<A>.flatMapParallel(transform: suspend (A) -> Iterable<B>): List<B> =
+ mapParallel(transform).flatten()
+
+/** Like [Iterable.mapNotNull] but executes each [transform] invocation in a separate coroutine. */
+suspend fun <A, B> Iterable<A>.mapNotNullParallel(transform: suspend (A) -> B?): List<B> =
+ mapParallel(transform).filterNotNull()
+
+/** Like [Iterable.map] but executes each [transform] invocation in a separate coroutine. */
+suspend fun <A, B> Iterable<A>.mapParallel(transform: suspend (A) -> B): List<B> = coroutineScope {
+ map { async(start = CoroutineStart.LAZY) { transform(it) } }.awaitAll()
+}
+
+/** Like [mapValues] but executes each [transform] invocation in a separate coroutine. */
+suspend fun <K, A, B> Map<K, A>.mapValuesParallel(
+ transform: suspend (Map.Entry<K, A>) -> B
+): Map<K, B> = entries.mapParallel { it.key to transform(it) }.toMap()
diff --git a/packages/SystemUI/src/com/android/systemui/util/sensors/SensorModule.java b/packages/SystemUI/src/com/android/systemui/util/sensors/SensorModule.java
index 7934ab1..a7b6de2 100644
--- a/packages/SystemUI/src/com/android/systemui/util/sensors/SensorModule.java
+++ b/packages/SystemUI/src/com/android/systemui/util/sensors/SensorModule.java
@@ -24,19 +24,19 @@
import androidx.annotation.NonNull;
-import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.util.concurrency.DelayableExecutor;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Dagger module for Sensor related classes.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index cd82e1d..c69fb66 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -137,13 +137,13 @@
import com.android.systemui.volume.domain.interactor.VolumePanelNavigationInteractor;
import com.android.systemui.volume.ui.navigation.VolumeNavigator;
+import dagger.Lazy;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
-import dagger.Lazy;
-
/**
* Visual presentation of the volume dialog.
*
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java
index 6050387..3785f13 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java
@@ -51,8 +51,8 @@
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import com.android.settingslib.media.MediaOutputConstants;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.ActivityStarter;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import java.util.ArrayList;
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeToolTipView.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeToolTipView.java
index 2143771..44382b6 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeToolTipView.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeToolTipView.java
@@ -28,8 +28,8 @@
import androidx.core.content.ContextCompat;
-import com.android.systemui.res.R;
import com.android.systemui.recents.TriangleShape;
+import com.android.systemui.res.R;
/**
* Tool tip view that draws an arrow that points to the volume dialog.
diff --git a/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java b/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java
index efba3e5..4841c78 100644
--- a/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java
+++ b/packages/SystemUI/src/com/android/systemui/wallet/dagger/WalletModule.java
@@ -17,6 +17,7 @@
package com.android.systemui.wallet.dagger;
import android.app.Activity;
+import android.app.Service;
import android.content.Context;
import android.service.quickaccesswallet.QuickAccessWalletClient;
@@ -24,10 +25,9 @@
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.qs.tiles.QuickAccessWalletTile;
+import com.android.systemui.wallet.controller.WalletContextualLocationsService;
import com.android.systemui.wallet.ui.WalletActivity;
-import java.util.concurrent.Executor;
-
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
@@ -35,8 +35,7 @@
import dagger.multibindings.IntoMap;
import dagger.multibindings.StringKey;
-import android.app.Service;
-import com.android.systemui.wallet.controller.WalletContextualLocationsService;
+import java.util.concurrent.Executor;
/**
* Module for injecting classes in Wallet.
diff --git a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java
index d21ccc9..53e6b4f 100644
--- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java
+++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java
@@ -43,9 +43,9 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.policy.KeyguardStateController;
diff --git a/packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt b/packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt
index 1ba269e..041b6f9 100644
--- a/packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/wallpapers/data/repository/WallpaperRepository.kt
@@ -28,7 +28,9 @@
import com.android.systemui.user.data.model.SelectedUserModel
import com.android.systemui.user.data.model.SelectionStatus
import com.android.systemui.user.data.repository.UserRepository
+import com.android.systemui.utils.coroutines.flow.mapLatestConflated
import javax.inject.Inject
+import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -40,6 +42,7 @@
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.withContext
/** A repository storing information about the current wallpaper. */
interface WallpaperRepository {
@@ -55,6 +58,7 @@
@Inject
constructor(
@Background scope: CoroutineScope,
+ @Background private val bgDispatcher: CoroutineDispatcher,
broadcastDispatcher: BroadcastDispatcher,
userRepository: UserRepository,
private val wallpaperManager: WallpaperManager,
@@ -87,14 +91,15 @@
if (!wallpaperManager.isWallpaperSupported || !deviceSupportsAodWallpaper) {
MutableStateFlow(null).asStateFlow()
} else {
- combine(wallpaperChanged, selectedUser) { _, selectedUser ->
- getWallpaper(selectedUser)
- }
+ combine(wallpaperChanged, selectedUser, ::Pair)
+ .mapLatestConflated { (_, selectedUser) -> getWallpaper(selectedUser) }
.stateIn(
scope,
// Always be listening for wallpaper changes.
SharingStarted.Eagerly,
- initialValue = getWallpaper(userRepository.selectedUser.value),
+ // The initial value is null, but it should get updated pretty quickly because
+ // the `combine` should immediately kick off a fetch.
+ initialValue = null,
)
}
@@ -111,7 +116,9 @@
initialValue = wallpaperInfo.value?.supportsAmbientMode() == true,
)
- private fun getWallpaper(selectedUser: SelectedUserModel): WallpaperInfo? {
- return wallpaperManager.getWallpaperInfoForUser(selectedUser.userInfo.id)
+ private suspend fun getWallpaper(selectedUser: SelectedUserModel): WallpaperInfo? {
+ return withContext(bgDispatcher) {
+ wallpaperManager.getWallpaperInfoForUser(selectedUser.userInfo.id)
+ }
}
}
diff --git a/packages/SystemUI/tests/robolectric/src/com/android/systemui/robotests/SysuiResourceLoadingTest.java b/packages/SystemUI/tests/robolectric/src/com/android/systemui/robotests/SysuiResourceLoadingTest.java
index 205168e..a48d179 100644
--- a/packages/SystemUI/tests/robolectric/src/com/android/systemui/robotests/SysuiResourceLoadingTest.java
+++ b/packages/SystemUI/tests/robolectric/src/com/android/systemui/robotests/SysuiResourceLoadingTest.java
@@ -16,9 +16,11 @@
package com.android.systemui.robotests;
+import static com.google.common.truth.Truth.assertThat;
+
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
-import static com.google.common.truth.Truth.assertThat;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
index 11d31c6..8c4179d 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
@@ -69,6 +69,8 @@
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -81,8 +83,6 @@
import java.util.HashMap;
import java.util.List;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class CarrierTextManagerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
index 8401e67..edf29c5 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java
@@ -27,8 +27,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerBaseTest.java
index f1dfdf4..07504c7 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerBaseTest.java
@@ -20,8 +20,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
-
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationGestureDetectorTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationGestureDetectorTest.java
index 36ae3c0..ad02179 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationGestureDetectorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationGestureDetectorTest.java
@@ -44,7 +44,6 @@
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class MagnificationGestureDetectorTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapterTest.java
index 403385f..630db62 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AccessibilityTargetAdapterTest.java
@@ -28,9 +28,9 @@
import androidx.test.filters.SmallTest;
import com.android.internal.accessibility.dialog.AccessibilityTarget;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.accessibility.floatingmenu.AccessibilityTargetAdapter.ViewHolder;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AnnotationLinkSpanTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AnnotationLinkSpanTest.java
index 43ebeee..4b87588 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AnnotationLinkSpanTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/floatingmenu/AnnotationLinkSpanTest.java
@@ -26,8 +26,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/assist/ui/DisplayUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/assist/ui/DisplayUtilsTest.java
index 957443a..4d582ab 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/assist/ui/DisplayUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/assist/ui/DisplayUtilsTest.java
@@ -25,8 +25,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/battery/BatteryMeterViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/battery/BatteryMeterViewControllerTest.java
index 323f15a..14eff2f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/battery/BatteryMeterViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/battery/BatteryMeterViewControllerTest.java
@@ -33,9 +33,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.flags.FakeFeatureFlags;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.StatusBarLocation;
import com.android.systemui.statusbar.policy.BatteryController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt
index 01d9df8..ec2b104 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderTest.kt
@@ -17,12 +17,10 @@
package com.android.systemui.biometrics.ui.binder
import android.animation.Animator
-import android.app.ActivityTaskManager
import android.graphics.Rect
import android.hardware.biometrics.SensorLocationInternal
import android.hardware.display.DisplayManager
import android.hardware.display.DisplayManagerGlobal
-import android.os.Handler
import android.testing.TestableLooper
import android.view.Display
import android.view.DisplayInfo
@@ -32,67 +30,31 @@
import android.view.WindowInsets
import android.view.WindowManager
import android.view.WindowMetrics
+import android.view.layoutInflater
+import android.view.windowManager
import androidx.test.filters.SmallTest
import com.airbnb.lottie.LottieAnimationView
-import com.android.keyguard.KeyguardSecurityModel
-import com.android.keyguard.KeyguardUpdateMonitor
+import com.android.keyguard.keyguardUpdateMonitor
import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider
-import com.android.systemui.biometrics.FpsUnlockTracker
-import com.android.systemui.biometrics.data.repository.FakeBiometricStatusRepository
-import com.android.systemui.biometrics.data.repository.FakeDisplayStateRepository
-import com.android.systemui.biometrics.data.repository.FakeFingerprintPropertyRepository
-import com.android.systemui.biometrics.domain.interactor.BiometricStatusInteractor
-import com.android.systemui.biometrics.domain.interactor.BiometricStatusInteractorImpl
-import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractorImpl
-import com.android.systemui.biometrics.domain.interactor.SideFpsSensorInteractor
+import com.android.systemui.biometrics.data.repository.biometricStatusRepository
+import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository
import com.android.systemui.biometrics.shared.model.AuthenticationReason
import com.android.systemui.biometrics.shared.model.DisplayRotation
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
import com.android.systemui.biometrics.shared.model.SensorStrength
-import com.android.systemui.biometrics.ui.viewmodel.SideFpsOverlayViewModel
-import com.android.systemui.bouncer.data.repository.FakeKeyguardBouncerRepository
-import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
-import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInteractor
-import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor
-import com.android.systemui.bouncer.ui.BouncerView
-import com.android.systemui.classifier.FalsingCollector
-import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
-import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFingerprintAuthInteractor
-import com.android.systemui.deviceentry.domain.interactor.deviceEntryFingerprintAuthInteractor
-import com.android.systemui.display.data.repository.FakeDisplayRepository
-import com.android.systemui.keyguard.DismissCallbackRegistry
-import com.android.systemui.keyguard.data.repository.FakeBiometricSettingsRepository
-import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFingerprintAuthRepository
-import com.android.systemui.keyguard.data.repository.FakeTrustRepository
-import com.android.systemui.keyguard.data.repository.biometricSettingsRepository
-import com.android.systemui.keyguard.domain.interactor.DeviceEntrySideFpsOverlayInteractor
-import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
-import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
-import com.android.systemui.keyguard.ui.viewmodel.SideFpsProgressBarViewModel
-import com.android.systemui.log.SideFpsLogger
-import com.android.systemui.log.logcatLogBuffer
-import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.power.domain.interactor.powerInteractor
+import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository
+import com.android.systemui.display.data.repository.displayRepository
+import com.android.systemui.display.data.repository.displayStateRepository
+import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel
+import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
-import com.android.systemui.scene.domain.interactor.sceneInteractor
-import com.android.systemui.statusbar.phone.dozeServiceHost
-import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.testKosmos
-import com.android.systemui.unfold.compat.ScreenSizeFoldProvider
-import com.android.systemui.user.domain.interactor.SelectedUserInteractor
-import com.android.systemui.util.concurrency.FakeExecutor
import com.android.systemui.util.mockito.eq
import com.android.systemui.util.mockito.whenever
-import com.android.systemui.util.time.FakeSystemClock
-import java.util.Optional
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
-import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
@@ -120,42 +82,14 @@
private val kosmos = testKosmos()
@JvmField @Rule var mockitoRule: MockitoRule = MockitoJUnit.rule()
- @Mock private lateinit var activityTaskManager: ActivityTaskManager
@Mock private lateinit var displayManager: DisplayManager
- @Mock private lateinit var faceAuthInteractor: DeviceEntryFaceAuthInteractor
@Mock
private lateinit var fingerprintInteractiveToAuthProvider: FingerprintInteractiveToAuthProvider
- @Mock private lateinit var fpsUnlockTracker: FpsUnlockTracker
- @Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
@Mock private lateinit var layoutInflater: LayoutInflater
- @Mock private lateinit var screenSizeFoldProvider: ScreenSizeFoldProvider
- @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor
@Mock private lateinit var sideFpsView: View
- @Mock private lateinit var windowManager: WindowManager
private val contextDisplayInfo = DisplayInfo()
- private val bouncerRepository = FakeKeyguardBouncerRepository()
- private val biometricSettingsRepository = FakeBiometricSettingsRepository()
- private val biometricStatusRepository = FakeBiometricStatusRepository()
- private val deviceEntryFingerprintAuthRepository = FakeDeviceEntryFingerprintAuthRepository()
- private val displayRepository = FakeDisplayRepository()
- private val displayStateRepository = FakeDisplayStateRepository()
- private val fingerprintPropertyRepository = FakeFingerprintPropertyRepository()
-
- private lateinit var underTest: SideFpsOverlayViewBinder
-
- private lateinit var alternateBouncerInteractor: AlternateBouncerInteractor
- private lateinit var biometricStatusInteractor: BiometricStatusInteractor
- private lateinit var deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor
- private lateinit var displayStateInteractor: DisplayStateInteractorImpl
- private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor
- private lateinit var sfpsSensorInteractor: SideFpsSensorInteractor
-
- private lateinit var sideFpsProgressBarViewModel: SideFpsProgressBarViewModel
-
- private lateinit var viewModel: SideFpsOverlayViewModel
-
private var displayWidth: Int = 0
private var displayHeight: Int = 0
private var boundsWidth: Int = 0
@@ -164,9 +98,6 @@
private lateinit var deviceConfig: DeviceConfig
private lateinit var sensorLocation: SensorLocationInternal
- private val testScope = TestScope(StandardTestDispatcher())
- private val fakeExecutor = FakeExecutor(FakeSystemClock())
-
enum class DeviceConfig {
X_ALIGNED,
Y_ALIGNED,
@@ -184,122 +115,13 @@
Display(mock(DisplayManagerGlobal::class.java), 1, contextDisplayInfo, resources)
)
- alternateBouncerInteractor =
- AlternateBouncerInteractor(
- mock(StatusBarStateController::class.java),
- mock(KeyguardStateController::class.java),
- bouncerRepository,
- fingerprintPropertyRepository,
- biometricSettingsRepository,
- FakeSystemClock(),
- keyguardUpdateMonitor,
- { mock(DeviceEntryFingerprintAuthInteractor::class.java) },
- { mock(KeyguardInteractor::class.java) },
- { mock(KeyguardTransitionInteractor::class.java) },
- testScope.backgroundScope,
- )
-
- biometricStatusInteractor =
- BiometricStatusInteractorImpl(
- activityTaskManager,
- biometricStatusRepository,
- fingerprintPropertyRepository
- )
-
- displayStateInteractor =
- DisplayStateInteractorImpl(
- testScope.backgroundScope,
- mContext,
- fakeExecutor,
- displayStateRepository,
- displayRepository,
- )
- displayStateInteractor.setScreenSizeFoldProvider(screenSizeFoldProvider)
-
- primaryBouncerInteractor =
- PrimaryBouncerInteractor(
- bouncerRepository,
- mock(BouncerView::class.java),
- mock(Handler::class.java),
- mock(KeyguardStateController::class.java),
- mock(KeyguardSecurityModel::class.java),
- mock(PrimaryBouncerCallbackInteractor::class.java),
- mock(FalsingCollector::class.java),
- mock(DismissCallbackRegistry::class.java),
- mContext,
- keyguardUpdateMonitor,
- FakeTrustRepository(),
- testScope.backgroundScope,
- selectedUserInteractor,
- faceAuthInteractor
- )
-
- deviceEntrySideFpsOverlayInteractor =
- DeviceEntrySideFpsOverlayInteractor(
- testScope.backgroundScope,
- mContext,
- deviceEntryFingerprintAuthRepository,
- kosmos.sceneInteractor,
- primaryBouncerInteractor,
- alternateBouncerInteractor,
- keyguardUpdateMonitor
- )
+ kosmos.layoutInflater = layoutInflater
whenever(fingerprintInteractiveToAuthProvider.enabledForCurrentUser)
.thenReturn(MutableStateFlow(false))
- sfpsSensorInteractor =
- SideFpsSensorInteractor(
- mContext,
- fingerprintPropertyRepository,
- windowManager,
- displayStateInteractor,
- Optional.of(fingerprintInteractiveToAuthProvider),
- kosmos.biometricSettingsRepository,
- kosmos.keyguardTransitionInteractor,
- SideFpsLogger(logcatLogBuffer("SfpsLogger"))
- )
-
- sideFpsProgressBarViewModel =
- SideFpsProgressBarViewModel(
- mContext,
- biometricStatusInteractor,
- kosmos.deviceEntryFingerprintAuthInteractor,
- sfpsSensorInteractor,
- kosmos.dozeServiceHost,
- kosmos.keyguardInteractor,
- displayStateInteractor,
- UnconfinedTestDispatcher(),
- testScope.backgroundScope,
- kosmos.powerInteractor,
- )
-
- viewModel =
- SideFpsOverlayViewModel(
- mContext,
- biometricStatusInteractor,
- deviceEntrySideFpsOverlayInteractor,
- displayStateInteractor,
- sfpsSensorInteractor,
- sideFpsProgressBarViewModel
- )
-
- underTest =
- SideFpsOverlayViewBinder(
- testScope.backgroundScope,
- mContext,
- { biometricStatusInteractor },
- { displayStateInteractor },
- { deviceEntrySideFpsOverlayInteractor },
- { fpsUnlockTracker },
- { layoutInflater },
- { sideFpsProgressBarViewModel },
- { sfpsSensorInteractor },
- { windowManager }
- )
-
context.addMockSystemService(DisplayManager::class.java, displayManager)
- context.addMockSystemService(WindowManager::class.java, windowManager)
+ context.addMockSystemService(WindowManager::class.java, kosmos.windowManager)
`when`(layoutInflater.inflate(R.layout.sidefps_view, null, false)).thenReturn(sideFpsView)
`when`(sideFpsView.requireViewById<LottieAnimationView>(eq(R.id.sidefps_animation)))
@@ -320,16 +142,16 @@
@Test
fun verifyIndicatorNotAdded_whenInRearDisplayMode() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = true
)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
updatePrimaryBouncer(
isShowing = true,
isAnimatingAway = false,
@@ -338,22 +160,22 @@
)
runCurrent()
- verify(windowManager, never()).addView(any(), any())
+ verify(kosmos.windowManager, never()).addView(any(), any())
}
}
@Test
fun verifyIndicatorShowAndHide_onPrimaryBouncerShowAndHide() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
// Show primary bouncer
updatePrimaryBouncer(
isShowing = true,
@@ -363,7 +185,7 @@
)
runCurrent()
- verify(windowManager).addView(any(), any())
+ verify(kosmos.windowManager).addView(any(), any())
// Hide primary bouncer
updatePrimaryBouncer(
@@ -374,45 +196,45 @@
)
runCurrent()
- verify(windowManager).removeView(any())
+ verify(kosmos.windowManager).removeView(any())
}
}
@Test
fun verifyIndicatorShowAndHide_onAlternateBouncerShowAndHide() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
// Show alternate bouncer
- bouncerRepository.setAlternateVisible(true)
+ kosmos.keyguardBouncerRepository.setAlternateVisible(true)
runCurrent()
- verify(windowManager).addView(any(), any())
+ verify(kosmos.windowManager).addView(any(), any())
// Hide alternate bouncer
- bouncerRepository.setAlternateVisible(false)
+ kosmos.keyguardBouncerRepository.setAlternateVisible(false)
runCurrent()
- verify(windowManager).removeView(any())
+ verify(kosmos.windowManager).removeView(any())
}
}
@Test
fun verifyIndicatorShownAndHidden_onSystemServerAuthenticationStartedAndStopped() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
updatePrimaryBouncer(
isShowing = false,
isAnimatingAway = false,
@@ -420,20 +242,20 @@
isUnlockingWithFpAllowed = true
)
// System server authentication started
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.BiometricPromptAuthentication
)
runCurrent()
- verify(windowManager).addView(any(), any())
+ verify(kosmos.windowManager).addView(any(), any())
// System server authentication stopped
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
runCurrent()
- verify(windowManager).removeView(any())
+ verify(kosmos.windowManager).removeView(any())
}
}
@@ -441,17 +263,17 @@
// On progress bar hidden - show indicator
@Test
fun verifyIndicatorProgressBarInteraction() {
- testScope.runTest {
+ kosmos.testScope.runTest {
// Pre-auth conditions
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
// Show primary bouncer
updatePrimaryBouncer(
@@ -462,26 +284,26 @@
)
runCurrent()
- val inOrder = inOrder(windowManager)
+ val inOrder = inOrder(kosmos.windowManager)
// Verify indicator shown
- inOrder.verify(windowManager).addView(any(), any())
+ inOrder.verify(kosmos.windowManager).addView(any(), any())
// Set progress bar visible
- sideFpsProgressBarViewModel.setVisible(true)
+ kosmos.sideFpsProgressBarViewModel.setVisible(true)
runCurrent()
// Verify indicator hidden
- inOrder.verify(windowManager).removeView(any())
+ inOrder.verify(kosmos.windowManager).removeView(any())
// Set progress bar invisible
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
runCurrent()
// Verify indicator shown
- inOrder.verify(windowManager).addView(any(), any())
+ inOrder.verify(kosmos.windowManager).addView(any(), any())
}
}
@@ -491,14 +313,16 @@
fpsDetectionRunning: Boolean,
isUnlockingWithFpAllowed: Boolean,
) {
- bouncerRepository.setPrimaryShow(isShowing)
- bouncerRepository.setPrimaryStartingToHide(false)
+ kosmos.keyguardBouncerRepository.setPrimaryShow(isShowing)
+ kosmos.keyguardBouncerRepository.setPrimaryStartingToHide(false)
val primaryStartDisappearAnimation = if (isAnimatingAway) Runnable {} else null
- bouncerRepository.setPrimaryStartDisappearAnimation(primaryStartDisappearAnimation)
+ kosmos.keyguardBouncerRepository.setPrimaryStartDisappearAnimation(
+ primaryStartDisappearAnimation
+ )
- whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning)
+ whenever(kosmos.keyguardUpdateMonitor.isFingerprintDetectionRunning)
.thenReturn(fpsDetectionRunning)
- whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
+ whenever(kosmos.keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
.thenReturn(isUnlockingWithFpAllowed)
mContext.orCreateTestableResources.addOverride(
R.bool.config_show_sidefps_hint_on_bouncer,
@@ -530,7 +354,7 @@
}
}
- whenever(windowManager.maximumWindowMetrics)
+ whenever(kosmos.windowManager.maximumWindowMetrics)
.thenReturn(
WindowMetrics(
Rect(0, 0, displayWidth, displayHeight),
@@ -540,17 +364,17 @@
contextDisplayInfo.uniqueId = DISPLAY_ID
- fingerprintPropertyRepository.setProperties(
+ kosmos.fingerprintPropertyRepository.setProperties(
sensorId = 1,
strength = SensorStrength.STRONG,
sensorType = FingerprintSensorType.POWER_BUTTON,
sensorLocations = mapOf(DISPLAY_ID to sensorLocation)
)
- displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode)
- displayStateRepository.setCurrentRotation(rotation)
- displayRepository.emitDisplayChangeEvent(0)
- underTest.start()
+ kosmos.displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode)
+ kosmos.displayStateRepository.setCurrentRotation(rotation)
+ kosmos.displayRepository.emitDisplayChangeEvent(0)
+ kosmos.sideFpsOverlayViewBinder.start()
runCurrent()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt
index 05ec64e..b065393 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelTest.kt
@@ -22,74 +22,39 @@
import android.graphics.Rect
import android.hardware.biometrics.SensorLocationInternal
import android.hardware.display.DisplayManagerGlobal
-import android.os.Handler
import android.view.Display
import android.view.DisplayInfo
import android.view.WindowInsets
-import android.view.WindowManager
import android.view.WindowMetrics
+import android.view.windowManager
import androidx.test.filters.SmallTest
import com.airbnb.lottie.model.KeyPath
-import com.android.keyguard.KeyguardSecurityModel
-import com.android.keyguard.KeyguardUpdateMonitor
+import com.android.keyguard.keyguardUpdateMonitor
import com.android.settingslib.Utils
import com.android.systemui.Flags.FLAG_CONSTRAINT_BP
import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider
-import com.android.systemui.biometrics.data.repository.FakeBiometricStatusRepository
-import com.android.systemui.biometrics.data.repository.FakeDisplayStateRepository
-import com.android.systemui.biometrics.data.repository.FakeFingerprintPropertyRepository
import com.android.systemui.biometrics.data.repository.biometricStatusRepository
-import com.android.systemui.biometrics.domain.interactor.DisplayStateInteractorImpl
-import com.android.systemui.biometrics.domain.interactor.SideFpsSensorInteractor
-import com.android.systemui.biometrics.domain.interactor.biometricStatusInteractor
+import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository
+import com.android.systemui.biometrics.domain.interactor.displayStateInteractor
import com.android.systemui.biometrics.shared.model.AuthenticationReason
import com.android.systemui.biometrics.shared.model.DisplayRotation
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
import com.android.systemui.biometrics.shared.model.LottieCallback
import com.android.systemui.biometrics.shared.model.SensorStrength
-import com.android.systemui.bouncer.data.repository.FakeKeyguardBouncerRepository
-import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
-import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInteractor
-import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor
-import com.android.systemui.bouncer.ui.BouncerView
-import com.android.systemui.classifier.FalsingCollector
+import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository
import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
-import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFingerprintAuthInteractor
-import com.android.systemui.deviceentry.domain.interactor.deviceEntryFingerprintAuthInteractor
-import com.android.systemui.display.data.repository.FakeDisplayRepository
-import com.android.systemui.keyguard.DismissCallbackRegistry
-import com.android.systemui.keyguard.data.repository.FakeBiometricSettingsRepository
-import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFingerprintAuthRepository
-import com.android.systemui.keyguard.data.repository.FakeTrustRepository
-import com.android.systemui.keyguard.data.repository.biometricSettingsRepository
-import com.android.systemui.keyguard.domain.interactor.DeviceEntrySideFpsOverlayInteractor
-import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
-import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
-import com.android.systemui.keyguard.ui.viewmodel.SideFpsProgressBarViewModel
-import com.android.systemui.kosmos.testDispatcher
-import com.android.systemui.log.SideFpsLogger
-import com.android.systemui.log.logcatLogBuffer
-import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.power.domain.interactor.powerInteractor
+import com.android.systemui.display.data.repository.displayRepository
+import com.android.systemui.display.data.repository.displayStateRepository
+import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel
+import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
-import com.android.systemui.scene.domain.interactor.sceneInteractor
-import com.android.systemui.statusbar.phone.dozeServiceHost
-import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.testKosmos
import com.android.systemui.unfold.compat.ScreenSizeFoldProvider
-import com.android.systemui.user.domain.interactor.SelectedUserInteractor
-import com.android.systemui.util.concurrency.FakeExecutor
import com.android.systemui.util.mockito.whenever
-import com.android.systemui.util.time.FakeSystemClock
import com.google.common.truth.Truth.assertThat
-import java.util.Optional
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
@@ -111,24 +76,12 @@
private val kosmos = testKosmos()
@JvmField @Rule var mockitoRule: MockitoRule = MockitoJUnit.rule()
- @Mock private lateinit var faceAuthInteractor: DeviceEntryFaceAuthInteractor
@Mock
private lateinit var fingerprintInteractiveToAuthProvider: FingerprintInteractiveToAuthProvider
- @Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
@Mock private lateinit var screenSizeFoldProvider: ScreenSizeFoldProvider
- @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor
- @Mock private lateinit var windowManager: WindowManager
private val contextDisplayInfo = DisplayInfo()
- private val bouncerRepository = FakeKeyguardBouncerRepository()
- private val biometricSettingsRepository = FakeBiometricSettingsRepository()
- private val biometricStatusRepository = FakeBiometricStatusRepository()
- private val deviceEntryFingerprintAuthRepository = FakeDeviceEntryFingerprintAuthRepository()
- private val displayRepository = FakeDisplayRepository()
- private val displayStateRepository = FakeDisplayStateRepository()
- private val fingerprintPropertyRepository = FakeFingerprintPropertyRepository()
-
private val indicatorColor =
Utils.getColorAttrDefaultColor(
context,
@@ -147,16 +100,6 @@
private val color_blue400 =
context.getColor(com.android.settingslib.color.R.color.settingslib_color_blue400)
- private lateinit var alternateBouncerInteractor: AlternateBouncerInteractor
- private lateinit var deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor
- private lateinit var displayStateInteractor: DisplayStateInteractorImpl
- private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor
- private lateinit var sfpsSensorInteractor: SideFpsSensorInteractor
-
- private lateinit var sideFpsProgressBarViewModel: SideFpsProgressBarViewModel
-
- private lateinit var underTest: SideFpsOverlayViewModel
-
private var displayWidth: Int = 0
private var displayHeight: Int = 0
private var boundsWidth: Int = 0
@@ -165,9 +108,6 @@
private lateinit var deviceConfig: DeviceConfig
private lateinit var sensorLocation: SensorLocationInternal
- private val testScope = TestScope(StandardTestDispatcher())
- private val fakeExecutor = FakeExecutor(FakeSystemClock())
-
enum class DeviceConfig {
X_ALIGNED,
Y_ALIGNED,
@@ -182,129 +122,40 @@
.thenReturn(
Display(mock(DisplayManagerGlobal::class.java), 1, contextDisplayInfo, resources)
)
- kosmos.biometricStatusRepository = biometricStatusRepository
-
- alternateBouncerInteractor =
- AlternateBouncerInteractor(
- mock(StatusBarStateController::class.java),
- mock(KeyguardStateController::class.java),
- bouncerRepository,
- fingerprintPropertyRepository,
- biometricSettingsRepository,
- FakeSystemClock(),
- keyguardUpdateMonitor,
- { mock(DeviceEntryFingerprintAuthInteractor::class.java) },
- { mock(KeyguardInteractor::class.java) },
- { mock(KeyguardTransitionInteractor::class.java) },
- testScope.backgroundScope,
- )
-
- displayStateInteractor =
- DisplayStateInteractorImpl(
- testScope.backgroundScope,
- mContext,
- fakeExecutor,
- displayStateRepository,
- displayRepository,
- )
- displayStateInteractor.setScreenSizeFoldProvider(screenSizeFoldProvider)
-
- primaryBouncerInteractor =
- PrimaryBouncerInteractor(
- bouncerRepository,
- mock(BouncerView::class.java),
- mock(Handler::class.java),
- mock(KeyguardStateController::class.java),
- mock(KeyguardSecurityModel::class.java),
- mock(PrimaryBouncerCallbackInteractor::class.java),
- mock(FalsingCollector::class.java),
- mock(DismissCallbackRegistry::class.java),
- mContext,
- keyguardUpdateMonitor,
- FakeTrustRepository(),
- testScope.backgroundScope,
- selectedUserInteractor,
- faceAuthInteractor
- )
-
- deviceEntrySideFpsOverlayInteractor =
- DeviceEntrySideFpsOverlayInteractor(
- testScope.backgroundScope,
- mContext,
- deviceEntryFingerprintAuthRepository,
- kosmos.sceneInteractor,
- primaryBouncerInteractor,
- alternateBouncerInteractor,
- keyguardUpdateMonitor
- )
+ kosmos.displayStateInteractor.setScreenSizeFoldProvider(screenSizeFoldProvider)
whenever(fingerprintInteractiveToAuthProvider.enabledForCurrentUser)
.thenReturn(MutableStateFlow(false))
-
- sfpsSensorInteractor =
- SideFpsSensorInteractor(
- mContext,
- fingerprintPropertyRepository,
- windowManager,
- displayStateInteractor,
- Optional.of(fingerprintInteractiveToAuthProvider),
- kosmos.biometricSettingsRepository,
- kosmos.keyguardTransitionInteractor,
- SideFpsLogger(logcatLogBuffer("SfpsLogger"))
- )
-
- sideFpsProgressBarViewModel =
- SideFpsProgressBarViewModel(
- mContext,
- kosmos.biometricStatusInteractor,
- kosmos.deviceEntryFingerprintAuthInteractor,
- sfpsSensorInteractor,
- kosmos.dozeServiceHost,
- kosmos.keyguardInteractor,
- displayStateInteractor,
- kosmos.testDispatcher,
- testScope.backgroundScope,
- kosmos.powerInteractor
- )
-
- underTest =
- SideFpsOverlayViewModel(
- mContext,
- kosmos.biometricStatusInteractor,
- deviceEntrySideFpsOverlayInteractor,
- displayStateInteractor,
- sfpsSensorInteractor,
- sideFpsProgressBarViewModel,
- )
}
@Test
fun updatesOverlayViewProperties_onDisplayRotationChange_xAlignedSensor() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- val overlayViewProperties by collectLastValue(underTest.overlayViewProperties)
+ val overlayViewProperties by
+ collectLastValue(kosmos.sideFpsOverlayViewModel.overlayViewProperties)
runCurrent()
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse_landscape)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(0f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(180f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse_landscape)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(180f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(0f)
@@ -313,31 +164,32 @@
@Test
fun updatesOverlayViewProperties_onDisplayRotationChange_yAlignedSensor() {
- testScope.runTest {
+ kosmos.testScope.runTest {
setupTestConfiguration(
DeviceConfig.Y_ALIGNED,
rotation = DisplayRotation.ROTATION_0,
isInRearDisplayMode = false
)
- val overlayViewProperties by collectLastValue(underTest.overlayViewProperties)
+ val overlayViewProperties by
+ collectLastValue(kosmos.sideFpsOverlayViewModel.overlayViewProperties)
runCurrent()
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_0)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_0)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(0f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse_landscape)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(0f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(180f)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
assertThat(overlayViewProperties?.indicatorAsset).isEqualTo(R.raw.sfps_pulse_landscape)
assertThat(overlayViewProperties?.overlayViewRotation).isEqualTo(180f)
@@ -346,7 +198,7 @@
@Test
fun updatesOverlayViewParams_onDisplayRotationChange_xAlignedSensor() {
- testScope.runTest {
+ kosmos.testScope.runTest {
mSetFlagsRule.disableFlags(FLAG_CONSTRAINT_BP)
setupTestConfiguration(
DeviceConfig.X_ALIGNED,
@@ -354,16 +206,17 @@
isInRearDisplayMode = false
)
- val overlayViewParams by collectLastValue(underTest.overlayViewParams)
+ val overlayViewParams by
+ collectLastValue(kosmos.sideFpsOverlayViewModel.overlayViewParams)
- underTest.setLottieBounds(Rect(0, 0, boundsWidth, boundsHeight))
+ kosmos.sideFpsOverlayViewModel.setLottieBounds(Rect(0, 0, boundsWidth, boundsHeight))
runCurrent()
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(sensorLocation.sensorLocationX)
assertThat(overlayViewParams!!.y).isEqualTo(0)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(0)
assertThat(overlayViewParams!!.y)
@@ -371,7 +224,7 @@
displayHeight - sensorLocation.sensorLocationX - sensorLocation.sensorRadius * 2
)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x)
.isEqualTo(
@@ -379,7 +232,7 @@
)
assertThat(overlayViewParams!!.y).isEqualTo(displayHeight - boundsHeight)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(displayWidth - boundsWidth)
assertThat(overlayViewParams!!.y).isEqualTo(sensorLocation.sensorLocationX)
@@ -388,7 +241,7 @@
@Test
fun updatesOverlayViewParams_onDisplayRotationChange_yAlignedSensor() {
- testScope.runTest {
+ kosmos.testScope.runTest {
mSetFlagsRule.disableFlags(FLAG_CONSTRAINT_BP)
setupTestConfiguration(
DeviceConfig.Y_ALIGNED,
@@ -396,21 +249,22 @@
isInRearDisplayMode = false
)
- val overlayViewParams by collectLastValue(underTest.overlayViewParams)
+ val overlayViewParams by
+ collectLastValue(kosmos.sideFpsOverlayViewModel.overlayViewParams)
- underTest.setLottieBounds(Rect(0, 0, boundsWidth, boundsHeight))
+ kosmos.sideFpsOverlayViewModel.setLottieBounds(Rect(0, 0, boundsWidth, boundsHeight))
runCurrent()
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(displayWidth - boundsWidth)
assertThat(overlayViewParams!!.y).isEqualTo(sensorLocation.sensorLocationY)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_90)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(sensorLocation.sensorLocationY)
assertThat(overlayViewParams!!.y).isEqualTo(0)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_180)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x).isEqualTo(0)
assertThat(overlayViewParams!!.y)
@@ -418,7 +272,7 @@
displayHeight - sensorLocation.sensorLocationY - sensorLocation.sensorRadius * 2
)
- displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
+ kosmos.displayStateRepository.setCurrentRotation(DisplayRotation.ROTATION_270)
assertThat(overlayViewParams).isNotNull()
assertThat(overlayViewParams!!.x)
.isEqualTo(
@@ -430,13 +284,13 @@
@Test
fun updatesLottieCallbacks_onShowIndicatorForDeviceEntry() {
- testScope.runTest {
- val lottieCallbacks by collectLastValue(underTest.lottieCallbacks)
+ kosmos.testScope.runTest {
+ val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.NotRunning
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
updatePrimaryBouncer(
isShowing = true,
@@ -457,14 +311,14 @@
@Test
fun updatesLottieCallbacks_onShowIndicatorForSystemServer_inDarkMode() {
- testScope.runTest {
- val lottieCallbacks by collectLastValue(underTest.lottieCallbacks)
+ kosmos.testScope.runTest {
+ val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks)
setDarkMode(true)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.BiometricPromptAuthentication
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
updatePrimaryBouncer(
isShowing = false,
@@ -483,14 +337,14 @@
@Test
fun updatesLottieCallbacks_onShowIndicatorForSystemServer_inLightMode() {
- testScope.runTest {
- val lottieCallbacks by collectLastValue(underTest.lottieCallbacks)
+ kosmos.testScope.runTest {
+ val lottieCallbacks by collectLastValue(kosmos.sideFpsOverlayViewModel.lottieCallbacks)
setDarkMode(false)
- biometricStatusRepository.setFingerprintAuthenticationReason(
+ kosmos.biometricStatusRepository.setFingerprintAuthenticationReason(
AuthenticationReason.BiometricPromptAuthentication
)
- sideFpsProgressBarViewModel.setVisible(false)
+ kosmos.sideFpsProgressBarViewModel.setVisible(false)
updatePrimaryBouncer(
isShowing = false,
@@ -526,14 +380,16 @@
fpsDetectionRunning: Boolean,
isUnlockingWithFpAllowed: Boolean,
) {
- bouncerRepository.setPrimaryShow(isShowing)
- bouncerRepository.setPrimaryStartingToHide(false)
+ kosmos.keyguardBouncerRepository.setPrimaryShow(isShowing)
+ kosmos.keyguardBouncerRepository.setPrimaryStartingToHide(false)
val primaryStartDisappearAnimation = if (isAnimatingAway) Runnable {} else null
- bouncerRepository.setPrimaryStartDisappearAnimation(primaryStartDisappearAnimation)
+ kosmos.keyguardBouncerRepository.setPrimaryStartDisappearAnimation(
+ primaryStartDisappearAnimation
+ )
- whenever(keyguardUpdateMonitor.isFingerprintDetectionRunning)
+ whenever(kosmos.keyguardUpdateMonitor.isFingerprintDetectionRunning)
.thenReturn(fpsDetectionRunning)
- whenever(keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
+ whenever(kosmos.keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed)
.thenReturn(isUnlockingWithFpAllowed)
mContext.orCreateTestableResources.addOverride(
R.bool.config_show_sidefps_hint_on_bouncer,
@@ -565,7 +421,7 @@
}
}
- whenever(windowManager.maximumWindowMetrics)
+ whenever(kosmos.windowManager.maximumWindowMetrics)
.thenReturn(
WindowMetrics(
Rect(0, 0, displayWidth, displayHeight),
@@ -575,18 +431,17 @@
contextDisplayInfo.uniqueId = DISPLAY_ID
- fingerprintPropertyRepository.setProperties(
+ kosmos.fingerprintPropertyRepository.setProperties(
sensorId = 1,
strength = SensorStrength.STRONG,
sensorType = FingerprintSensorType.POWER_BUTTON,
sensorLocations = mapOf(DISPLAY_ID to sensorLocation)
)
- displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode)
+ kosmos.displayStateRepository.setIsInRearDisplayMode(isInRearDisplayMode)
+ kosmos.displayStateRepository.setCurrentRotation(rotation)
- displayStateRepository.setCurrentRotation(rotation)
-
- displayRepository.emitDisplayChangeEvent(0)
+ kosmos.displayRepository.emitDisplayChangeEvent(0)
runCurrent()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingCollectorImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingCollectorImplTest.java
index 8e5ddc7..bc6c459 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingCollectorImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingCollectorImplTest.java
@@ -50,6 +50,8 @@
import com.android.systemui.util.sensors.ThresholdSensor;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.flow.StateFlowKt;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,8 +60,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.flow.StateFlowKt;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/ClipboardOverlayUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/ClipboardOverlayUtilsTest.java
index db85522..63e43d7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/ClipboardOverlayUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/ClipboardOverlayUtilsTest.java
@@ -39,8 +39,8 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.google.android.collect.Lists;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/IntentCreatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/IntentCreatorTest.java
index fb07e6e..ea6cb3b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/IntentCreatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/IntentCreatorTest.java
@@ -28,8 +28,8 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/common/ui/view/SeekBarWithIconButtonsViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/common/ui/view/SeekBarWithIconButtonsViewTest.java
index 98f7f59..4c4205e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/common/ui/view/SeekBarWithIconButtonsViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/common/ui/view/SeekBarWithIconButtonsViewTest.java
@@ -33,9 +33,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.common.ui.view.SeekBarWithIconButtonsView.OnSeekBarWithIconButtonsChangeListener;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationLayoutEngineTest.java b/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationLayoutEngineTest.java
index a78f0b7..baaeee1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationLayoutEngineTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationLayoutEngineTest.java
@@ -28,9 +28,9 @@
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.complication.ComplicationLayoutEngine.Margins;
+import com.android.systemui.res.R;
import com.android.systemui.touch.TouchInsetManager;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationUtilsTest.java
index 235c56b..e23e1f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/complication/ComplicationUtilsTest.java
@@ -27,7 +27,6 @@
import static com.android.systemui.complication.ComplicationUtils.convertComplicationType;
import static com.android.systemui.complication.ComplicationUtils.convertComplicationTypes;
-
import static com.google.common.truth.Truth.assertThat;
import android.testing.AndroidTestingRunner;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
index ea7467f..e1dc696 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/AlwaysOnDisplayPolicyTest.java
@@ -24,8 +24,8 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.After;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuppressorTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuppressorTest.java
index 9064470..92941f9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuppressorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSuppressorTest.java
@@ -47,6 +47,8 @@
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
+import dagger.Lazy;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -57,8 +59,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import dagger.Lazy;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@UiThreadTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsColumnLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsColumnLayoutTest.java
index f89a0b6..f4fadaa 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsColumnLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsColumnLayoutTest.java
@@ -30,8 +30,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.android.systemui.util.leak.RotationUtils;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsGridLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsGridLayoutTest.java
index 5a97b74..84b1c00 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsGridLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsGridLayoutTest.java
@@ -28,8 +28,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.android.systemui.util.leak.RotationUtils;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/ListGridLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/ListGridLayoutTest.java
index a003e07..4c65b90 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/ListGridLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/ListGridLayoutTest.java
@@ -25,8 +25,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/ShutdownUiTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/ShutdownUiTest.java
index 2d3ca60..28c01ad 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/ShutdownUiTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/ShutdownUiTest.java
@@ -40,7 +40,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class ShutdownUiTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index 709f779..59f7d61 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -133,6 +133,10 @@
import com.android.systemui.wallpapers.data.repository.FakeWallpaperRepository;
import com.android.wm.shell.keyguard.KeyguardTransitions;
+import kotlinx.coroutines.CoroutineDispatcher;
+import kotlinx.coroutines.flow.Flow;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -143,10 +147,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineDispatcher;
-import kotlinx.coroutines.flow.Flow;
-import kotlinx.coroutines.test.TestScope;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/logcat/LogAccessDialogActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/logcat/LogAccessDialogActivityTest.java
index eed7ecd..aef05a7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/logcat/LogAccessDialogActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/logcat/LogAccessDialogActivityTest.java
@@ -31,8 +31,8 @@
import androidx.test.platform.app.InstrumentationRegistry;
import com.android.internal.app.ILogAccessDialogCallback;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Rule;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
index 2f057a2..95e34a9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
@@ -46,8 +46,8 @@
import com.android.settingslib.media.LocalMediaManager;
import com.android.settingslib.media.MediaDevice;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.google.common.collect.ImmutableList;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/systemsounds/HomeSoundEffectControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/systemsounds/HomeSoundEffectControllerTest.java
index 33a30e0..293f66b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/systemsounds/HomeSoundEffectControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/systemsounds/HomeSoundEffectControllerTest.java
@@ -45,7 +45,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HomeSoundEffectControllerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
index 30d66dc..84a8ab0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
@@ -58,10 +58,10 @@
import androidx.test.filters.SmallTest;
import com.android.internal.appwidget.IAppWidgetService;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.people.widget.PeopleSpaceWidgetManager;
import com.android.systemui.people.widget.PeopleTileKey;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
index d0e8cce..3d1da00 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
@@ -60,9 +60,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.people.widget.PeopleTileKey;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/process/condition/SystemProcessConditionTest.java b/packages/SystemUI/tests/src/com/android/systemui/process/condition/SystemProcessConditionTest.java
index ff60fcd..f573358 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/process/condition/SystemProcessConditionTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/process/condition/SystemProcessConditionTest.java
@@ -31,14 +31,14 @@
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineScope;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterViewControllerTest.java
index 98e803f..5ae0c24 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSFooterViewControllerTest.java
@@ -34,9 +34,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.res.R;
import com.android.systemui.retail.data.repository.FakeRetailModeRepository;
import com.android.systemui.retail.domain.interactor.RetailModeInteractorImpl;
import com.android.systemui.settings.UserTracker;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
index d3cd26b..df0ab34 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/customize/TileQueryHelperTest.java
@@ -50,10 +50,10 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.InstanceId;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.qs.QSHost;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
index efbfb4f..46ee569 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
@@ -60,6 +60,8 @@
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -71,8 +73,6 @@
import java.util.ArrayList;
import java.util.List;
-import kotlinx.coroutines.test.TestScope;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ColorInversionTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ColorInversionTileTest.java
index c93ff4b..ea43326 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ColorInversionTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ColorInversionTileTest.java
@@ -32,7 +32,6 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
@@ -42,6 +41,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.settings.SecureSettings;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java
index 954d30ed..a3c2975 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java
@@ -41,7 +41,6 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.classifier.FalsingManagerFake;
@@ -51,6 +50,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.settings.SecureSettings;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/HotspotTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/HotspotTileTest.java
index 14dfdea..a85b49b6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/HotspotTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/HotspotTileTest.java
@@ -31,7 +31,6 @@
import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.internal.logging.MetricsLogger;
import com.android.settingslib.wifi.WifiEnterpriseRestrictionUtils;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
@@ -41,6 +40,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DataSaverController;
import com.android.systemui.statusbar.policy.HotspotController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
index 288facc..0ea61f9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
@@ -17,6 +17,7 @@
package com.android.systemui.qs.tiles;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -28,7 +29,6 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
@@ -38,6 +38,7 @@
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.qs.tiles.dialog.InternetDialogManager;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.connectivity.AccessPointController;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.NetworkController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/NfcTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/NfcTileTest.java
index 118ad2c..f6bc692 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/NfcTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/NfcTileTest.java
@@ -30,7 +30,6 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.classifier.FalsingManagerFake;
@@ -39,6 +38,7 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
+import com.android.systemui.res.R;
import org.junit.After;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
index 7b3171d..d7beb5d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
@@ -30,7 +30,6 @@
import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
@@ -41,6 +40,7 @@
import com.android.systemui.qs.QsEventLogger;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R;
import org.junit.After;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
index c5721ff..8eaa876 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
@@ -32,7 +32,6 @@
import com.android.internal.R;
import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R.drawable;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
@@ -43,6 +42,7 @@
import com.android.systemui.qs.ReduceBrightColorsController;
import com.android.systemui.qs.logging.QSLogger;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import com.android.systemui.res.R.drawable;
import com.android.systemui.settings.UserTracker;
import org.junit.After;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateControllerTest.java
index b384fe8..2536a93 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateControllerTest.java
@@ -5,6 +5,7 @@
import static android.telephony.SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
import static android.telephony.SignalStrength.SIGNAL_STRENGTH_GREAT;
import static android.telephony.SignalStrength.SIGNAL_STRENGTH_POOR;
+
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.settingslib.wifi.WifiUtils.getHotspotIconResource;
import static com.android.systemui.qs.tiles.dialog.InternetDialogController.TOAST_PARAMS_HORIZONTAL_WEIGHT;
@@ -12,7 +13,9 @@
import static com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MAX;
import static com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MIN;
import static com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE;
+
import static com.google.common.truth.Truth.assertThat;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingControllerTest.java
index 9e559de..2444af7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/RecordingControllerTest.java
@@ -17,9 +17,12 @@
package com.android.systemui.screenrecord;
import static android.os.Process.myUid;
+
import static com.google.common.truth.Truth.assertThat;
+
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java
index 10bd6af..4b7d5f0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java
@@ -38,10 +38,12 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.android.systemui.util.FakeSharedPreferences;
+import kotlin.Unit;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,9 +53,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import kotlin.Unit;
-
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class WorkProfileMessageControllerTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
index 2c7b606..68a6893 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
@@ -47,8 +47,8 @@
import androidx.test.runner.intercepting.SingleActivityFactory;
import com.android.internal.logging.UiEventLogger;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.android.systemui.screenshot.ImageExporter;
import com.android.systemui.settings.UserTracker;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
index 3d55527..6733ead 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsTrampolineActivityTest.java
@@ -57,12 +57,12 @@
import com.android.internal.infra.ServiceConnector;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IAppClipsService;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastSender;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.notetask.NoteTaskController;
+import com.android.systemui.res.R;
import com.google.common.util.concurrent.MoreExecutors;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
index d5e88fe..3793970 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
@@ -23,6 +23,9 @@
import static com.google.common.truth.Truth.assertThat;
+import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
+import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat;
@@ -37,9 +40,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
-import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
-
import android.annotation.IdRes;
import android.content.ContentResolver;
import android.content.res.Configuration;
@@ -202,6 +202,9 @@
import dagger.Lazy;
+import kotlinx.coroutines.CoroutineDispatcher;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.mockito.ArgumentCaptor;
@@ -213,9 +216,6 @@
import java.util.List;
import java.util.Optional;
-import kotlinx.coroutines.CoroutineDispatcher;
-import kotlinx.coroutines.test.TestScope;
-
public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
protected static final int SPLIT_SHADE_FULL_TRANSITION_DISTANCE = 400;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java
index 0f51878..317e35c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java
@@ -16,14 +16,14 @@
package com.android.systemui.shade;
+import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
+import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
-
import android.content.res.Resources;
import android.os.Handler;
import android.os.Looper;
@@ -98,13 +98,13 @@
import dagger.Lazy;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.test.TestScope;
-
public class QuickSettingsControllerImplBaseTest extends SysuiTestCase {
protected static final float QS_FRAME_START_X = 0f;
protected static final int QS_FRAME_WIDTH = 1000;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
index e7056c7..4c2d908 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
@@ -62,6 +62,8 @@
import com.android.systemui.utils.leaks.LeakCheckedTest;
import com.android.systemui.utils.os.FakeHandler;
+import kotlinx.coroutines.flow.MutableStateFlow;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -73,8 +75,6 @@
import java.util.Arrays;
import java.util.List;
-import kotlinx.coroutines.flow.MutableStateFlow;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
index a657edf..a42121a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
@@ -31,8 +31,8 @@
import androidx.test.filters.SmallTest;
import com.android.settingslib.mobile.TelephonyIcons;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java
index 0b1753f..65ca0a2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionMonitorTest.java
@@ -36,6 +36,8 @@
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,8 +50,6 @@
import java.util.Collections;
import java.util.HashSet;
-import kotlinx.coroutines.CoroutineScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class ConditionMonitorTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java
index 6efade9..cec5d0a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/condition/ConditionTest.java
@@ -31,14 +31,14 @@
import com.android.systemui.SysuiTestCase;
+import kotlinx.coroutines.CoroutineScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.CoroutineScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class ConditionTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
index 544860e..775dc3c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java
@@ -36,9 +36,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.statusbar.IStatusBarService;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java
index eafa78e..0103564 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicChildBindControllerTest.java
@@ -55,7 +55,6 @@
import java.util.List;
import java.util.Map;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java
index af52459..3676a3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/DeviceProvisionedCoordinatorTest.java
@@ -27,7 +27,6 @@
import android.app.ActivityManagerInternal;
import android.app.Notification;
import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.RemoteException;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
index 6f0a19d..50ae985 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
@@ -20,6 +20,8 @@
import static junit.framework.Assert.assertFalse;
+import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
+
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -29,8 +31,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
-
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -62,6 +62,9 @@
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.flow.MutableStateFlow;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -71,9 +74,6 @@
import org.mockito.MockitoAnnotations;
import org.mockito.verification.VerificationMode;
-import kotlinx.coroutines.flow.MutableStateFlow;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterViewTest.java
index 6bda4d4..a21ca94 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterViewTest.java
@@ -50,11 +50,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.util.List;
-
import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;
+import java.util.List;
+
@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
public class FooterViewTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java
index 06410cd..8662048 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java
@@ -55,7 +55,6 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FakeFeatureFlagsClassic;
import com.android.systemui.flags.FeatureFlagsClassic;
-import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
index bb68ec5..1113091 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.notification.logging;
+import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
+
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,8 +30,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
-
import android.app.Notification;
import android.os.Handler;
import android.os.Looper;
@@ -72,6 +72,8 @@
import com.google.android.collect.Lists;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -84,8 +86,6 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
index bdc8135..9d2f32d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
@@ -47,7 +47,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 9e2856d..907649b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -28,6 +28,8 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
+import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
@@ -42,8 +44,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
-
import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -98,6 +98,8 @@
import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.wmshell.BubblesManager;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -109,8 +111,6 @@
import java.util.Optional;
-import kotlinx.coroutines.test.TestScope;
-
/**
* Tests for {@link NotificationGutsManager}.
*/
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java
index edf2b4c..180c8c8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java
@@ -18,8 +18,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -37,8 +35,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.io.IOException;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class NotificationInlineImageResolverTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
index f35ec74..1661860 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
@@ -99,6 +99,10 @@
import com.android.systemui.wmshell.BubblesManager;
import com.android.systemui.wmshell.BubblesTestActivity;
+import kotlin.coroutines.CoroutineContext;
+
+import kotlinx.coroutines.test.TestScope;
+
import org.mockito.ArgumentCaptor;
import java.util.Objects;
@@ -107,9 +111,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
-import kotlin.coroutines.CoroutineContext;
-import kotlinx.coroutines.test.TestScope;
-
/**
* A helper class to create {@link ExpandableNotificationRow} (for both individual and group
* notifications).
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
index e3a77d3..fad85f53 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
@@ -21,8 +21,6 @@
import android.content.Context;
import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
-import android.testing.TestableLooper.RunWithLooper;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 041e61c..f666d8e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -27,6 +27,8 @@
import static com.google.common.truth.Truth.assertThat;
+import static kotlinx.coroutines.flow.FlowKt.flowOf;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -44,8 +46,6 @@
import static java.util.Collections.emptySet;
-import static kotlinx.coroutines.flow.FlowKt.flowOf;
-
import android.app.ActivityManager;
import android.app.IWallpaperManager;
import android.app.WallpaperManager;
@@ -195,6 +195,8 @@
import dagger.Lazy;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -208,8 +210,6 @@
import javax.inject.Provider;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWithLooper(setAsMainLooper = true)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
index a6a4f24..6704b6c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewControllerTest.java
@@ -87,6 +87,8 @@
import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -95,8 +97,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java
index e88fd95..c44f979 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewTest.java
@@ -25,8 +25,8 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import org.junit.Before;
import org.junit.Test;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java
index f6419a9..7271a5e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java
@@ -55,6 +55,8 @@
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.util.kotlin.JavaAdapter;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -64,8 +66,6 @@
import java.util.Arrays;
import java.util.List;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java
index d25a06b..ccd1a8c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationTapHelperTest.java
@@ -29,9 +29,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
+import com.android.systemui.res.R;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index f947640..1000329 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -24,6 +24,8 @@
import static com.google.common.truth.Truth.assertThat;
+import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
@@ -41,8 +43,6 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
-
import android.animation.Animator;
import android.app.AlarmManager;
import android.content.Context;
@@ -89,6 +89,8 @@
import com.google.common.truth.Expect;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -105,8 +107,6 @@
import java.util.HashSet;
import java.util.Map;
-import kotlinx.coroutines.test.TestScope;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index f04a5ab..e38e31d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -19,6 +19,8 @@
import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN;
import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE;
+import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -35,8 +37,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher;
-
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
index 3fae3f6..784fb71 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
@@ -38,9 +38,9 @@
import androidx.test.filters.SmallTest;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
+import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import org.junit.Before;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
index bf280c9..456723d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/InflatedSmartRepliesTest.java
@@ -37,8 +37,8 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.res.R;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
import com.android.systemui.shared.system.PackageManagerWrapper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
index 479309c..3a086ae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java
@@ -52,7 +52,6 @@
import java.util.Random;
-
@SmallTest
@TestableLooper.RunWithLooper
@RunWith(AndroidTestingRunner.class)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
index b9557d2..a9681e0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyConstantsTest.java
@@ -21,7 +21,6 @@
import static junit.framework.Assert.assertTrue;
import android.app.RemoteInput;
-import android.os.Handler;
import android.provider.DeviceConfig;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
index 4b6c68a..a213c85 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java
@@ -47,11 +47,11 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.res.R;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.SmartReplyController;
@@ -60,6 +60,9 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
+import kotlin.sequences.Sequence;
+import kotlin.sequences.SequencesKt;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -76,9 +79,6 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;
-import kotlin.sequences.Sequence;
-import kotlin.sequences.SequencesKt;
-
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@SmallTest
diff --git a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectTest.kt b/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectTest.kt
deleted file mode 100644
index 8105cc5..0000000
--- a/packages/SystemUI/tests/src/com/android/systemui/surfaceeffects/gloweffect/GlowPieEffectTest.kt
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.surfaceeffects.gloweffect
-
-import android.graphics.Color
-import android.graphics.RenderEffect
-import android.testing.AndroidTestingRunner
-import android.testing.TestableLooper
-import androidx.test.filters.SmallTest
-import com.android.systemui.animation.AnimatorTestRule
-import com.android.systemui.model.SysUiStateTest
-import com.android.systemui.surfaceeffects.RenderEffectDrawCallback
-import com.google.common.truth.Truth.assertThat
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@SmallTest
-@RunWith(AndroidTestingRunner::class)
-@TestableLooper.RunWithLooper(setAsMainLooper = true)
-class GlowPieEffectTest : SysUiStateTest() {
-
- @get:Rule val animatorTestRule = AnimatorTestRule(this)
-
- @Test
- fun play_triggersDrawCallback() {
- var effectFromCallback: RenderEffect? = null
- val glowPieEffectConfig =
- GlowPieEffectConfig(
- centerX = 0f,
- centerY = 0f,
- width = 1f,
- height = 1f,
- cornerRadius = 0.5f,
- colors = intArrayOf(Color.RED, Color.GREEN, Color.BLUE)
- )
- val drawCallback =
- object : RenderEffectDrawCallback {
- override fun onDraw(renderEffect: RenderEffect) {
- effectFromCallback = renderEffect
- }
- }
- val glowPieEffect = GlowPieEffect(glowPieEffectConfig, drawCallback)
-
- assertThat(effectFromCallback).isNull()
-
- glowPieEffect.play()
-
- animatorTestRule.advanceTimeBy(100L)
-
- assertThat(effectFromCallback).isNotNull()
- }
-
- @Test
- fun finish_cancelsAnimator() {
- val glowPieEffectConfig =
- GlowPieEffectConfig(
- centerX = 0f,
- centerY = 0f,
- width = 1f,
- height = 1f,
- cornerRadius = 0.5f,
- colors = intArrayOf(Color.RED, Color.GREEN, Color.BLUE)
- )
- val drawCallback =
- object : RenderEffectDrawCallback {
- override fun onDraw(renderEffect: RenderEffect) {}
- }
- val glowPieEffect = GlowPieEffect(glowPieEffectConfig, drawCallback)
-
- glowPieEffect.play()
- animatorTestRule.advanceTimeBy(100L)
-
- assertThat(glowPieEffect.mainAnimator.isRunning).isTrue()
-
- glowPieEffect.finish()
-
- assertThat(glowPieEffect.mainAnimator.isRunning).isFalse()
- }
-
- @Test
- fun glowPie_progress_computesProgressCorrectly() {
- val myGlowPieConfig =
- object : GlowPieEffect.GlowPie {
- override val startMs: Float = 0f
- override val endMs: Float = GlowPieEffect.DURATION_MS.toFloat()
- override val startAngle: Float = 0f
- override val endAngle: Float = 6f * GlowPieEffect.PI
- override val alphaFadeStartMs: Float = 0f
- override val alphaFadeEndMs: Float = GlowPieEffect.DURATION_MS.toFloat()
- override var progress: Float = 0f
- override var time: Float = 0f
- }
-
- val playTime = GlowPieEffect.DURATION_MS.toFloat() * 0.5f
- val tolerance = 1e-4f
- myGlowPieConfig.updateProgress(playTime)
-
- assertThat(myGlowPieConfig.time).isWithin(tolerance).of(playTime)
- assertThat(myGlowPieConfig.progress).isWithin(tolerance).of(0.5f)
- assertThat(myGlowPieConfig.angle()).isWithin(tolerance).of(-3.5f * GlowPieEffect.PI)
- assertThat(myGlowPieConfig.bottomThreshold())
- .isWithin(tolerance)
- .of((1f - GlowPieEffect.FEATHER) * 0.5f)
- assertThat(myGlowPieConfig.topThreshold())
- .isWithin(tolerance)
- .of((1f + GlowPieEffect.FEATHER) * 0.5f)
- assertThat(myGlowPieConfig.alpha()).isWithin(tolerance).of(0.5f)
-
- myGlowPieConfig.resetProgress()
-
- assertThat(myGlowPieConfig.time).isEqualTo(0f)
- assertThat(myGlowPieConfig.progress).isEqualTo(0f)
- }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java
index 31bad2c..9dfa14d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/concurrency/FakeExecutorTest.java
@@ -29,6 +29,8 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.util.time.FakeSystemClock;
+import kotlin.jvm.functions.Function4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,8 +38,6 @@
import java.util.ArrayList;
import java.util.List;
-import kotlin.jvm.functions.Function4;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class FakeExecutorTest extends SysuiTestCase {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt
index f8b096a..7d89a55 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt
@@ -33,6 +33,7 @@
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
@@ -41,13 +42,15 @@
@OptIn(ExperimentalCoroutinesApi::class)
class WallpaperRepositoryImplTest : SysuiTestCase() {
- private val testScope = TestScope(StandardTestDispatcher())
+ private val testDispatcher = StandardTestDispatcher()
+ private val testScope = TestScope(testDispatcher)
private val userRepository = FakeUserRepository()
private val wallpaperManager: WallpaperManager = mock()
private val underTest: WallpaperRepositoryImpl by lazy {
WallpaperRepositoryImpl(
testScope.backgroundScope,
+ testDispatcher,
fakeBroadcastDispatcher,
userRepository,
wallpaperManager,
@@ -102,8 +105,10 @@
userRepository.setUserInfos(listOf(USER_WITH_SUPPORTED_WP))
userRepository.setSelectedUserInfo(USER_WITH_SUPPORTED_WP)
- // WHEN the repo initially starts up (underTest is lazy), then it fetches the current
- // value for the wallpaper
+ // Start up the repo and let it run the initial fetch
+ underTest.wallpaperInfo
+ runCurrent()
+
assertThat(underTest.wallpaperInfo.value).isEqualTo(SUPPORTED_WP)
}
@@ -282,6 +287,10 @@
userRepository.setUserInfos(listOf(USER_WITH_SUPPORTED_WP))
userRepository.setSelectedUserInfo(USER_WITH_SUPPORTED_WP)
+ // Start up the repo and let it run the initial fetch
+ underTest.wallpaperSupportsAmbientMode
+ runCurrent()
+
// WHEN the repo initially starts up (underTest is lazy), then it fetches the current
// value for the wallpaper
assertThat(underTest.wallpaperSupportsAmbientMode.value).isTrue()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
index d9a0c4b..db998f3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java
@@ -30,6 +30,8 @@
import static com.google.common.truth.Truth.assertThat;
+import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -50,8 +52,6 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;
-
import android.app.ActivityManager;
import android.app.IActivityManager;
import android.app.INotificationManager;
@@ -207,6 +207,8 @@
import com.android.wm.shell.taskview.TaskViewTransitions;
import com.android.wm.shell.transition.Transitions;
+import kotlinx.coroutines.test.TestScope;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -225,8 +227,6 @@
import java.util.Optional;
import java.util.concurrent.Executor;
-import kotlinx.coroutines.test.TestScope;
-
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
diff --git a/packages/SystemUI/tests/utils/src/android/view/LayoutInflaterKosmos.kt b/packages/SystemUI/tests/utils/src/android/view/LayoutInflaterKosmos.kt
index 34c0a79..21dea6b 100644
--- a/packages/SystemUI/tests/utils/src/android/view/LayoutInflaterKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/android/view/LayoutInflaterKosmos.kt
@@ -19,5 +19,5 @@
import android.content.applicationContext
import com.android.systemui.kosmos.Kosmos
-val Kosmos.layoutInflater: LayoutInflater by
+var Kosmos.layoutInflater: LayoutInflater by
Kosmos.Fixture { LayoutInflater.from(applicationContext) }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/FpsUnlockTrackerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/FpsUnlockTrackerKosmos.kt
new file mode 100644
index 0000000..6085a1f
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/FpsUnlockTrackerKosmos.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.biometrics
+
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.util.mockito.mock
+
+val Kosmos.fpsUnlockTracker by Kosmos.Fixture { mock<FpsUnlockTracker>() }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt
new file mode 100644
index 0000000..8281984
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinderKosmos.kt
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.biometrics.ui.binder
+
+import android.content.applicationContext
+import android.view.layoutInflater
+import android.view.windowManager
+import com.android.systemui.biometrics.domain.interactor.biometricStatusInteractor
+import com.android.systemui.biometrics.domain.interactor.displayStateInteractor
+import com.android.systemui.biometrics.domain.interactor.sideFpsSensorInteractor
+import com.android.systemui.biometrics.fpsUnlockTracker
+import com.android.systemui.keyguard.domain.interactor.deviceEntrySideFpsOverlayInteractor
+import com.android.systemui.keyguard.ui.viewmodel.sideFpsProgressBarViewModel
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+import com.android.systemui.kosmos.applicationCoroutineScope
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+
+@OptIn(ExperimentalCoroutinesApi::class)
+val Kosmos.sideFpsOverlayViewBinder by Fixture {
+ SideFpsOverlayViewBinder(
+ applicationScope = applicationCoroutineScope,
+ applicationContext = applicationContext,
+ { biometricStatusInteractor },
+ { displayStateInteractor },
+ { deviceEntrySideFpsOverlayInteractor },
+ { fpsUnlockTracker },
+ { layoutInflater },
+ { sideFpsProgressBarViewModel },
+ { sideFpsSensorInteractor },
+ { windowManager }
+ )
+}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt
new file mode 100644
index 0000000..de03855
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/biometrics/ui/viewmodel/SideFpsOverlayViewModelKosmos.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.biometrics.ui.viewmodel
+
+import android.content.applicationContext
+import com.android.systemui.biometrics.domain.interactor.displayStateInteractor
+import com.android.systemui.biometrics.domain.interactor.sideFpsSensorInteractor
+import com.android.systemui.keyguard.domain.interactor.deviceEntrySideFpsOverlayInteractor
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+
+@OptIn(ExperimentalCoroutinesApi::class)
+val Kosmos.sideFpsOverlayViewModel by Fixture {
+ SideFpsOverlayViewModel(
+ applicationContext = applicationContext,
+ deviceEntrySideFpsOverlayInteractor = deviceEntrySideFpsOverlayInteractor,
+ displayStateInteractor = displayStateInteractor,
+ sfpsSensorInteractor = sideFpsSensorInteractor,
+ )
+}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt
index 4a02f6d..4394847 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorKosmos.kt
@@ -26,7 +26,7 @@
import com.android.systemui.kosmos.testScope
import com.android.systemui.log.sessionTracker
import com.android.systemui.power.domain.interactor.powerInteractor
-import com.android.systemui.scene.domain.interactor.sceneInteractor
+import com.android.systemui.scene.domain.interactor.sceneBackInteractor
val Kosmos.bouncerInteractor by Fixture {
BouncerInteractor(
@@ -38,6 +38,6 @@
powerInteractor = powerInteractor,
uiEventLogger = uiEventLogger,
sessionTracker = sessionTracker,
- sceneInteractor = sceneInteractor,
+ sceneBackInteractor = sceneBackInteractor,
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorKosmos.kt
new file mode 100644
index 0000000..4ccee6f
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractorKosmos.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.keyguard.domain.interactor
+
+import android.content.applicationContext
+import com.android.keyguard.keyguardUpdateMonitor
+import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor
+import com.android.systemui.bouncer.domain.interactor.primaryBouncerInteractor
+import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.domain.interactor.sceneInteractor
+
+val Kosmos.deviceEntrySideFpsOverlayInteractor: DeviceEntrySideFpsOverlayInteractor by
+ Kosmos.Fixture {
+ DeviceEntrySideFpsOverlayInteractor(
+ applicationScope = testScope.backgroundScope,
+ context = applicationContext,
+ deviceEntryFingerprintAuthRepository = deviceEntryFingerprintAuthRepository,
+ sceneInteractor = sceneInteractor,
+ primaryBouncerInteractor = primaryBouncerInteractor,
+ alternateBouncerInteractor = alternateBouncerInteractor,
+ keyguardUpdateMonitor = keyguardUpdateMonitor
+ )
+ }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelKosmos.kt
new file mode 100644
index 0000000..8da16fc
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/SideFpsProgressBarViewModelKosmos.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@file:OptIn(ExperimentalCoroutinesApi::class)
+
+package com.android.systemui.keyguard.ui.viewmodel
+
+import android.content.applicationContext
+import com.android.systemui.biometrics.domain.interactor.biometricStatusInteractor
+import com.android.systemui.biometrics.domain.interactor.displayStateInteractor
+import com.android.systemui.biometrics.domain.interactor.sideFpsSensorInteractor
+import com.android.systemui.deviceentry.domain.interactor.deviceEntryFingerprintAuthInteractor
+import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.testDispatcher
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.power.domain.interactor.powerInteractor
+import com.android.systemui.statusbar.phone.dozeServiceHost
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+
+val Kosmos.sideFpsProgressBarViewModel by
+ Kosmos.Fixture {
+ SideFpsProgressBarViewModel(
+ context = applicationContext,
+ biometricStatusInteractor = biometricStatusInteractor,
+ deviceEntryFingerprintAuthInteractor = deviceEntryFingerprintAuthInteractor,
+ sfpsSensorInteractor = sideFpsSensorInteractor,
+ dozeServiceHost = dozeServiceHost,
+ keyguardInteractor = keyguardInteractor,
+ displayStateInteractor = displayStateInteractor,
+ mainDispatcher = testDispatcher,
+ applicationScope = testScope.backgroundScope,
+ powerInteractor = powerInteractor
+ )
+ }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt
index 7f6a7bd..16d08dd 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneKosmos.kt
@@ -32,4 +32,15 @@
val Kosmos.scenes by Fixture { fakeScenes }
val Kosmos.initialSceneKey by Fixture { Scenes.Lockscreen }
-val Kosmos.sceneContainerConfig by Fixture { SceneContainerConfig(sceneKeys, initialSceneKey) }
+val Kosmos.sceneContainerConfig by Fixture {
+ val navigationDistances =
+ mapOf(
+ Scenes.Gone to 0,
+ Scenes.Lockscreen to 0,
+ Scenes.Communal to 1,
+ Scenes.Shade to 2,
+ Scenes.QuickSettings to 3,
+ Scenes.Bouncer to 4,
+ )
+ SceneContainerConfig(sceneKeys, initialSceneKey, navigationDistances)
+}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorKosmos.kt
new file mode 100644
index 0000000..e46ede6
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorKosmos.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.scene.domain.interactor
+
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+import com.android.systemui.scene.sceneContainerConfig
+import com.android.systemui.scene.shared.logger.sceneLogger
+
+val Kosmos.sceneBackInteractor by Fixture {
+ SceneBackInteractor(
+ logger = sceneLogger,
+ sceneContainerConfig = sceneContainerConfig,
+ )
+}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneContainerStartableKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneContainerStartableKosmos.kt
index c7cf934..c0f5039 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneContainerStartableKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/interactor/SceneContainerStartableKosmos.kt
@@ -39,7 +39,6 @@
import com.android.systemui.statusbar.notificationShadeWindowController
import com.android.systemui.statusbar.phone.centralSurfaces
import com.android.systemui.statusbar.policy.domain.interactor.deviceProvisioningInteractor
-import dagger.Lazy
val Kosmos.sceneContainerStartable by Fixture {
SceneContainerStartable(
@@ -55,8 +54,8 @@
falsingCollector = falsingCollector,
falsingManager = falsingManager,
powerInteractor = powerInteractor,
- simBouncerInteractor = Lazy { simBouncerInteractor },
- authenticationInteractor = Lazy { authenticationInteractor },
+ simBouncerInteractor = { simBouncerInteractor },
+ authenticationInteractor = { authenticationInteractor },
windowController = notificationShadeWindowController,
deviceProvisioningInteractor = deviceProvisioningInteractor,
centralSurfaces = centralSurfaces,
@@ -65,5 +64,6 @@
faceUnlockInteractor = deviceEntryFaceAuthInteractor,
shadeInteractor = shadeInteractor,
uiEventLogger = uiEventLogger,
+ sceneBackInteractor = sceneBackInteractor,
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/screenshot/scroll/FakeSession.java b/packages/SystemUI/tests/utils/src/com/android/systemui/screenshot/scroll/FakeSession.java
index 3b7b158..502e0de 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/screenshot/scroll/FakeSession.java
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/screenshot/scroll/FakeSession.java
@@ -32,8 +32,6 @@
import android.media.Image;
import android.util.Log;
-import com.android.systemui.screenshot.scroll.ScrollCaptureClient;
-
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
index b91f7e6..2bd584e 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
@@ -33,10 +33,10 @@
import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection;
import com.android.systemui.util.time.FakeSystemClock;
-import java.util.ArrayList;
-
import kotlin.Unit;
+import java.util.ArrayList;
+
/**
* Combined builder for constructing a NotificationEntry and its associated StatusBarNotification
* and Ranking. Is largely a proxy for the SBN and Ranking builders, but does a little extra magic
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index 8905ad3..3337419 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -163,6 +163,8 @@
test_suites: ["general-tests"],
data: [
":framework-minus-apex.ravenwood.stats",
+ ":framework-minus-apex.ravenwood.apis",
":services.core.ravenwood.stats",
+ ":services.core.ravenwood.apis",
],
}
diff --git a/ravenwood/scripts/ravenwood-stats-collector.sh b/ravenwood/scripts/ravenwood-stats-collector.sh
index 4dcaa2b..b5843d0 100755
--- a/ravenwood/scripts/ravenwood-stats-collector.sh
+++ b/ravenwood/scripts/ravenwood-stats-collector.sh
@@ -17,8 +17,9 @@
set -e
-# Output file
-out=/tmp/ravenwood-stats-all.csv
+# Output files
+stats=/tmp/ravenwood-stats-all.csv
+apis=/tmp/ravenwood-apis-all.csv
# Where the input files are.
path=$ANDROID_BUILD_TOP/out/host/linux-x86/testcases/ravenwood-stats-checker/x86_64/
@@ -41,12 +42,28 @@
sed -e '1d' -e "s/^/$jar,/" $file
}
-collect() {
- echo 'Jar,PackageName,ClassName,SupportedMethods,TotalMethods'
- dump "framework-minus-apex" hoststubgen_framework-minus-apex_stats.csv
- dump "service.core" hoststubgen_services.core_stats.csv
+collect_stats() {
+ local out="$1"
+ {
+ echo 'Jar,PackageName,ClassName,SupportedMethods,TotalMethods'
+ dump "framework-minus-apex" hoststubgen_framework-minus-apex_stats.csv
+ dump "service.core" hoststubgen_services.core_stats.csv
+ } > "$out"
+
+ echo "Stats CVS created at $out"
}
-collect >$out
+collect_apis() {
+ local out="$1"
+ {
+ echo 'Jar,PackageName,ClassName,MethodName,Descriptor'
+ dump "framework-minus-apex" hoststubgen_framework-minus-apex_apis.csv
+ dump "service.core" hoststubgen_services.core_apis.csv
+ } > "$out"
-echo "Full dump CVS created at $out"
+ echo "API CVS created at $out"
+}
+
+
+collect_stats $stats
+collect_apis $apis
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index cf09cfb..49f2c8b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -4436,8 +4436,17 @@
packageName, null, userId);
}
- final boolean clearPendingIntentsForStoppedApp = (android.content.pm.Flags.stayStopped()
- && packageStateStopped);
+ boolean clearPendingIntentsForStoppedApp = false;
+ try {
+ clearPendingIntentsForStoppedApp = (packageStateStopped
+ && android.content.pm.Flags.stayStopped());
+ } catch (IllegalStateException e) {
+ // It's unlikely for a package to be force-stopped early in the boot cycle. So, if we
+ // check for 'packageStateStopped' which should evaluate to 'false', then this should
+ // ensure we are not accessing the flag early in the boot cycle. As an additional
+ // safety measure, catch the exception and ignore to avoid causing a device restart.
+ clearPendingIntentsForStoppedApp = false;
+ }
if (packageName == null || uninstalling || clearPendingIntentsForStoppedApp) {
final int cancelReason;
if (packageName == null) {
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 7bd47f5..44a200e 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -6419,7 +6419,7 @@
nextEnabledImeIds[i] = nextEnabledImes.get(i).getId();
}
settings.putEnabledInputMethodsStr(InputMethodUtils.concatEnabledImeIds(
- settings.getEnabledInputMethodsStr(), nextEnabledImeIds));
+ "", nextEnabledImeIds));
// Reset selected IME.
settings.putSelectedInputMethod(nextIme);
diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
index e5807e8..54303c0 100644
--- a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
+++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java
@@ -1082,7 +1082,8 @@
int keyguardCredentialsType = lockPatternUtilsToKeyguardType(savedCredentialType);
try (LockscreenCredential credential =
createLockscreenCredential(keyguardCredentialsType, decryptedCredentials)) {
- // TODO(b/254335492): remove decryptedCredentials
+ Arrays.fill(decryptedCredentials, (byte) 0);
+ decryptedCredentials = null;
VerifyCredentialResponse verifyResponse =
lockSettingsService.verifyCredential(credential, userId, 0);
return handleVerifyCredentialResponse(verifyResponse, userId);
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperCropper.java b/services/core/java/com/android/server/wallpaper/WallpaperCropper.java
index f6e0168..b19bc7d 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperCropper.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperCropper.java
@@ -99,15 +99,17 @@
/**
* Given the dimensions of the original wallpaper image, some optional suggested crops
- * (either defined by the user, or coming from a backup), and whether the device is RTL,
+ * (either defined by the user, or coming from a backup), and whether the device has RTL layout,
* generate a crop for the current display. This is done through the following process:
* <ul>
- * <li> If no suggested crops are provided, center the full image on the display. </li>
+ * <li> If no suggested crops are provided, in most cases render the full image left-aligned
+ * (or right-aligned if RTL) and use any additional width for parallax up to
+ * {@link #MAX_PARALLAX}. There are exceptions, see comments in "Case 1" of this function.
* <li> If there is a suggested crop the given displaySize, reuse the suggested crop and
- * adjust it using {@link #getAdjustedCrop}. </li>
+ * adjust it using {@link #getAdjustedCrop}.
* <li> If there are suggested crops, but not for the orientation of the given displaySize,
* reuse one of the suggested crop for another orientation and adjust if using
- * {@link #getAdjustedCrop}. </li>
+ * {@link #getAdjustedCrop}.
* </ul>
*
* @param displaySize The dimensions of the surface where we want to render the wallpaper
@@ -270,16 +272,12 @@
* Adjust a given crop:
* <ul>
* <li>If parallax = true, make sure we have a parallax of at most {@link #MAX_PARALLAX},
- * by removing content from the right (or left if RTL) if necessary.
- * </li>
+ * by removing content from the right (or left if RTL layout) if necessary.
* <li>If parallax = false, make sure we do not have additional width for parallax. If we
* have additional width for parallax, remove half of the additional width on both sides.
- * </li>
* <li>Make sure the crop fills the screen, i.e. that the width/height ratio of the crop
- * is at least the width/height ratio of the screen. If it is less, add width to the crop
- * (if possible on both sides) to fill the screen. If not enough width available, remove
- * height to the crop.
- * </li>
+ * is at least the width/height ratio of the screen. This is done accordingly to the
+ * {@code mode} used, which can be either {@link #ADD}, {@link #REMOVE} or {@link #BALANCE}.
* </ul>
*/
@VisibleForTesting
diff --git a/services/core/jni/OWNERS b/services/core/jni/OWNERS
index 736b051..25c5db1 100644
--- a/services/core/jni/OWNERS
+++ b/services/core/jni/OWNERS
@@ -34,3 +34,6 @@
# Bug component : 158088 = per-file *AnrTimer*
per-file *AnrTimer* = file:/PERFORMANCE_OWNERS
+
+# HintManagerService
+per-file com_android_server_hint_HintManagerService.cpp = file:/ADPF_OWNERS
diff --git a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/testing/TestActivity.java b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/testing/TestActivity.java
index 73b4501..37b05ff 100644
--- a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/testing/TestActivity.java
+++ b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/testing/TestActivity.java
@@ -77,6 +77,7 @@
mEditText = new EditText(this);
mEditText.setContentDescription("Input box");
rootView.addView(mEditText, new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
+ rootView.setFitsSystemWindows(true);
setContentView(rootView);
mEditText.requestFocus();
sLastCreatedInstance = new WeakReference<>(this);
diff --git a/services/tests/wmtests/src/com/android/server/wm/BackNavigationControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/BackNavigationControllerTests.java
index a911131..ab8c53c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/BackNavigationControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/BackNavigationControllerTests.java
@@ -53,6 +53,7 @@
import android.content.pm.ApplicationInfo;
import android.content.res.Resources;
import android.os.Bundle;
+import android.os.Looper;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.platform.test.annotations.Presubmit;
@@ -531,7 +532,7 @@
Task task = createTopTaskWithActivity();
WindowState appWindow = task.getTopVisibleAppMainWindow();
WindowOnBackInvokedDispatcher dispatcher =
- new WindowOnBackInvokedDispatcher(context);
+ new WindowOnBackInvokedDispatcher(context, Looper.getMainLooper());
spyOn(appWindow.mSession);
doAnswer(invocation -> {
appWindow.setOnBackInvokedCallbackInfo(invocation.getArgument(1));
@@ -742,6 +743,10 @@
@Override
public void onBackInvoked() {
}
+
+ @Override
+ public void setTriggerBack(boolean triggerBack) {
+ }
};
}
diff --git a/tests/MultiDeviceInput/src/test/multideviceinput/DrawingView.kt b/tests/MultiDeviceInput/src/test/multideviceinput/DrawingView.kt
index b5bd9ca..8bc2f97 100644
--- a/tests/MultiDeviceInput/src/test/multideviceinput/DrawingView.kt
+++ b/tests/MultiDeviceInput/src/test/multideviceinput/DrawingView.kt
@@ -21,8 +21,13 @@
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
+import android.view.InputDevice
+import android.view.InputDevice.SOURCE_MOUSE
import android.view.InputDevice.SOURCE_STYLUS
+import android.view.InputDevice.SOURCE_TOUCHSCREEN
+import android.view.InputDevice.SOURCE_TOUCHPAD
import android.view.MotionEvent
+import android.view.MotionEvent.ACTION_CANCEL
import android.view.MotionEvent.ACTION_DOWN
import android.view.MotionEvent.ACTION_HOVER_EXIT
import android.view.MotionEvent.ACTION_UP
@@ -56,8 +61,8 @@
}
private fun drawCircle(canvas: Canvas, event: MotionEvent, paint: Paint, radius: Float) {
- val x = event.getX()
- val y = event.getY()
+ val x = event.x
+ val y = event.y
canvas.drawCircle(x, y, radius, paint)
}
@@ -110,44 +115,72 @@
private val scaleGestureDetector = ScaleGestureDetector(context, scaleGestureListener, null)
private var touchPaint = Paint()
+ private var touchpadPaint = Paint()
private var stylusPaint = Paint()
+ private var mousePaint = Paint()
+ private var drawingTabletPaint = Paint()
private fun init() {
touchPaint.color = Color.RED
- touchPaint.setStrokeWidth(5f)
+ touchPaint.strokeWidth = 5f
+ touchpadPaint.color = Color.BLACK
+ touchpadPaint.strokeWidth = 5f
stylusPaint.color = Color.YELLOW
- stylusPaint.setStrokeWidth(5f)
-
+ stylusPaint.strokeWidth = 5f
+ mousePaint.color = Color.BLUE
+ mousePaint.strokeWidth = 5f
+ drawingTabletPaint.color = Color.GREEN
+ drawingTabletPaint.strokeWidth = 5f
setOnHoverListener { _, event -> processHoverEvent(event); true }
}
+ private fun resolvePaint(event: MotionEvent): Paint? {
+ val inputDevice = InputDevice.getDevice(event.deviceId)
+ val isTouchpadDevice = inputDevice != null && inputDevice.supportsSource(SOURCE_TOUCHPAD)
+ return if (event.isFromSource(SOURCE_STYLUS or SOURCE_MOUSE)) {
+ // External stylus / drawing tablet
+ drawingTabletPaint
+ } else if (event.isFromSource(SOURCE_TOUCHSCREEN) && !event.isFromSource(SOURCE_STYLUS)) {
+ // Touchscreen event
+ touchPaint
+ } else if (event.isFromSource(SOURCE_MOUSE) &&
+ (event.isFromSource(SOURCE_TOUCHPAD) || isTouchpadDevice)) {
+ // Touchpad event
+ touchpadPaint
+ } else if (event.isFromSource(SOURCE_MOUSE)) {
+ // Mouse event
+ mousePaint
+ } else if (event.isFromSource(SOURCE_STYLUS)) {
+ // Stylus event
+ stylusPaint
+ } else {
+ // Drop the event
+ null
+ }
+ }
+
private fun processTouchEvent(event: MotionEvent) {
scaleGestureDetector.onTouchEvent(event)
if (event.actionMasked == ACTION_DOWN) {
touchEvents.remove(event.deviceId)
myState?.state = PointerState.DOWN
- } else if (event.actionMasked == ACTION_UP) {
+ } else if (event.actionMasked == ACTION_UP || event.actionMasked == ACTION_CANCEL) {
myState?.state = PointerState.NONE
}
- var vec = touchEvents.getOrPut(event.deviceId) { Vector<Pair<MotionEvent, Paint>>() }
-
- val paint = if (event.isFromSource(SOURCE_STYLUS)) {
+ val paint = resolvePaint(event)
+ if (paint != null) {
+ val vec = touchEvents.getOrPut(event.deviceId) { Vector<Pair<MotionEvent, Paint>>() }
val size = myState?.lineSize ?: 5f
- stylusPaint.setStrokeWidth(size)
- Paint(stylusPaint)
- } else {
- val size = myState?.lineSize ?: 5f
- touchPaint.setStrokeWidth(size)
- Paint(touchPaint)
+ paint.strokeWidth = size
+ vec.add(Pair(MotionEvent.obtain(event), Paint(paint)))
+ invalidate()
}
- vec.add(Pair(MotionEvent.obtain(event), paint))
- invalidate()
}
private fun processHoverEvent(event: MotionEvent) {
hoverEvents.remove(event.deviceId)
- if (event.getActionMasked() != ACTION_HOVER_EXIT) {
- hoverEvents.put(event.deviceId, MotionEvent.obtain(event))
+ if (event.actionMasked != ACTION_HOVER_EXIT) {
+ hoverEvents[event.deviceId] = MotionEvent.obtain(event)
myState?.state = PointerState.HOVER
} else {
myState?.state = PointerState.NONE
@@ -155,7 +188,7 @@
invalidate()
}
- public override fun onTouchEvent(event: MotionEvent): Boolean {
+ override fun onTouchEvent(event: MotionEvent): Boolean {
processTouchEvent(event)
return true
}
@@ -171,12 +204,10 @@
}
// Draw hovers
for ((_, event) in hoverEvents ) {
- if (event.isFromSource(SOURCE_STYLUS)) {
+ val paint = resolvePaint(event)
+ if (paint != null) {
val size = myState?.circleSize ?: 20f
- drawCircle(canvas, event, stylusPaint, size)
- } else {
- val size = myState?.circleSize ?: 20f
- drawCircle(canvas, event, touchPaint, size)
+ drawCircle(canvas, event, paint, size)
}
}
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
index 803dc28..2f432cc 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt
@@ -85,9 +85,13 @@
// Dump statistics, if specified.
options.statsFile.ifSet {
- PrintWriter(it).use { pw -> stats.dump(pw) }
+ PrintWriter(it).use { pw -> stats.dumpOverview(pw) }
log.i("Dump file created at $it")
}
+ options.apiListFile.ifSet {
+ PrintWriter(it).use { pw -> stats.dumpApis(pw) }
+ log.i("API list file created at $it")
+ }
}
/**
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
index 9ff798a..e192516 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt
@@ -110,6 +110,8 @@
var enableNonStubMethodCallDetection: SetOnce<Boolean> = SetOnce(false),
var statsFile: SetOnce<String?> = SetOnce(null),
+
+ var apiListFile: SetOnce<String?> = SetOnce(null),
) {
companion object {
@@ -255,6 +257,7 @@
"--debug-log" -> setLogFile(LogLevel.Debug, nextArg())
"--stats-file" -> ret.statsFile.setNextStringArg()
+ "--supported-api-list-file" -> ret.apiListFile.setNextStringArg()
else -> throw ArgumentsException("Unknown option: $arg")
}
@@ -392,6 +395,7 @@
enablePostTrace=$enablePostTrace,
enableNonStubMethodCallDetection=$enableNonStubMethodCallDetection,
statsFile=$statsFile,
+ apiListFile=$apiListFile,
}
""".trimIndent()
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenStats.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenStats.kt
index 50518e1..da61469 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenStats.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/HostStubGenStats.kt
@@ -29,8 +29,25 @@
private val stats = mutableMapOf<String, Stats>()
- fun onVisitPolicyForMethod(fullClassName: String, methodName: String, descriptor: String,
- policy: FilterPolicyWithReason, access: Int) {
+ data class Api(
+ val fullClassName: String,
+ val methodName: String,
+ val methodDesc: String,
+ )
+
+ private val apis = mutableListOf<Api>()
+
+ fun onVisitPolicyForMethod(
+ fullClassName: String,
+ methodName: String,
+ descriptor: String,
+ policy: FilterPolicyWithReason,
+ access: Int
+ ) {
+ if (policy.policy.isSupported) {
+ apis.add(Api(fullClassName, methodName, descriptor))
+ }
+
// Ignore methods that aren't public
if ((access and Opcodes.ACC_PUBLIC) == 0) return
// Ignore methods that are abstract
@@ -39,7 +56,7 @@
if (policy.isIgnoredForStats) return
val packageName = resolvePackageName(fullClassName)
- val className = resolveClassName(fullClassName)
+ val className = resolveOuterClassName(fullClassName)
// Ignore methods for certain generated code
if (className.endsWith("Proto")
@@ -60,11 +77,11 @@
classStats.total += 1
}
- fun dump(pw: PrintWriter) {
+ fun dumpOverview(pw: PrintWriter) {
pw.printf("PackageName,ClassName,SupportedMethods,TotalMethods\n")
- stats.forEach { (packageName, packageStats) ->
+ stats.toSortedMap().forEach { (packageName, packageStats) ->
if (packageStats.supported > 0) {
- packageStats.children.forEach { (className, classStats) ->
+ packageStats.children.toSortedMap().forEach { (className, classStats) ->
pw.printf("%s,%s,%d,%d\n", packageName, className,
classStats.supported, classStats.total)
}
@@ -72,12 +89,26 @@
}
}
+ fun dumpApis(pw: PrintWriter) {
+ pw.printf("PackageName,ClassName,MethodName,MethodDesc\n")
+ apis.sortedWith(compareBy({ it.fullClassName }, { it.methodName }, { it.methodDesc }))
+ .forEach { api ->
+ pw.printf(
+ "%s,%s,%s,%s\n",
+ csvEscape(resolvePackageName(api.fullClassName)),
+ csvEscape(resolveClassName(api.fullClassName)),
+ csvEscape(api.methodName),
+ csvEscape(api.methodDesc),
+ )
+ }
+ }
+
private fun resolvePackageName(fullClassName: String): String {
val start = fullClassName.lastIndexOf('/')
return fullClassName.substring(0, start).toHumanReadableClassName()
}
- private fun resolveClassName(fullClassName: String): String {
+ private fun resolveOuterClassName(fullClassName: String): String {
val start = fullClassName.lastIndexOf('/')
val end = fullClassName.indexOf('$')
if (end == -1) {
@@ -86,4 +117,13 @@
return fullClassName.substring(start + 1, end)
}
}
+
+ private fun resolveClassName(fullClassName: String): String {
+ val pos = fullClassName.lastIndexOf('/')
+ if (pos == -1) {
+ return fullClassName
+ } else {
+ return fullClassName.substring(pos + 1)
+ }
+ }
}
diff --git a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Utils.kt b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Utils.kt
index aa63d8d9..10179ee 100644
--- a/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Utils.kt
+++ b/tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/Utils.kt
@@ -89,3 +89,10 @@
}
}
}
+
+/**
+ * Escape a string for a CSV field.
+ */
+fun csvEscape(value: String): String {
+ return "\"" + value.replace("\"", "\"\"") + "\""
+}