Remove meaningless parameter in IActivityTaskManager#setLockScreenShown
After ag/5760456, we can remove the parameter secondaryDisplaysShowing
since it becomes meaningless.
Fix: 123373363
Test: atest ActivityManagerMultiDisplayTests
atest ActivityManagerDisplayKeyguardTests
atest ActivityManagerDisplayLockedKeyguardTests
atest KeyguardTests
Change-Id: I5ab5753985bc570bb730b4c7f801cdc263cc1858
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
index 583dac7..9dd9717 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java
@@ -17,7 +17,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import android.annotation.Nullable;
import android.app.Presentation;
import android.content.Context;
import android.graphics.Point;
@@ -32,15 +31,11 @@
import android.view.View;
import android.view.WindowManager;
-import java.util.function.BooleanSupplier;
-
// TODO(multi-display): Support multiple external displays
public class KeyguardDisplayManager {
protected static final String TAG = "KeyguardDisplayManager";
private static boolean DEBUG = KeyguardConstants.DEBUG;
- private final ViewMediatorCallback mCallback;
-
private final MediaRouter mMediaRouter;
private final DisplayManager mDisplayService;
private final Context mContext;
@@ -57,7 +52,7 @@
public void onDisplayAdded(int displayId) {
final Display display = mDisplayService.getDisplay(displayId);
if (mShowing) {
- notifyIfChanged(() -> showPresentation(display));
+ showPresentation(display);
}
}
@@ -76,13 +71,12 @@
@Override
public void onDisplayRemoved(int displayId) {
- notifyIfChanged(() -> hidePresentation(displayId));
+ hidePresentation(displayId);
}
};
- public KeyguardDisplayManager(Context context, ViewMediatorCallback callback) {
+ public KeyguardDisplayManager(Context context) {
mContext = context;
- mCallback = callback;
mMediaRouter = mContext.getSystemService(MediaRouter.class);
mDisplayService = mContext.getSystemService(DisplayManager.class);
mDisplayService.registerDisplayListener(mDisplayListener, null /* handler */);
@@ -138,42 +132,13 @@
/**
* @param displayId The id of the display to hide the presentation off.
- * @return {@code true} if the a presentation was removed.
- * {@code false} if the presentation was not added before.
*/
- private boolean hidePresentation(int displayId) {
+ private void hidePresentation(int displayId) {
final Presentation presentation = mPresentations.get(displayId);
if (presentation != null) {
presentation.dismiss();
mPresentations.remove(displayId);
- return true;
}
- return false;
- }
-
- private void notifyIfChanged(BooleanSupplier updateMethod) {
- if (updateMethod.getAsBoolean()) {
- final int[] displayList = getPresentationDisplayIds();
- mCallback.onSecondaryDisplayShowingChanged(displayList);
- }
- }
-
- /**
- * @return An array of displayId's on which a {@link KeyguardPresentation} is showing on.
- */
- @Nullable
- private int[] getPresentationDisplayIds() {
- final int size = mPresentations.size();
- if (size == 0) return null;
-
- final int[] displayIds = new int[size];
- for (int i = mPresentations.size() - 1; i >= 0; i--) {
- final Presentation presentation = mPresentations.valueAt(i);
- if (presentation != null) {
- displayIds[i] = presentation.getDisplay().getDisplayId();
- }
- }
- return displayIds;
}
public void show() {
@@ -181,7 +146,7 @@
if (DEBUG) Log.v(TAG, "show");
mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY,
mMediaRouterCallback, MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
- notifyIfChanged(() -> updateDisplays(true /* showing */));
+ updateDisplays(true /* showing */);
}
mShowing = true;
}
@@ -190,7 +155,7 @@
if (mShowing) {
if (DEBUG) Log.v(TAG, "hide");
mMediaRouter.removeCallback(mMediaRouterCallback);
- notifyIfChanged(() -> updateDisplays(false /* showing */));
+ updateDisplays(false /* showing */);
}
mShowing = false;
}
@@ -200,19 +165,19 @@
@Override
public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {
if (DEBUG) Log.d(TAG, "onRouteSelected: type=" + type + ", info=" + info);
- notifyIfChanged(() -> updateDisplays(mShowing));
+ updateDisplays(mShowing);
}
@Override
public void onRouteUnselected(MediaRouter router, int type, RouteInfo info) {
if (DEBUG) Log.d(TAG, "onRouteUnselected: type=" + type + ", info=" + info);
- notifyIfChanged(() -> updateDisplays(mShowing));
+ updateDisplays(mShowing);
}
@Override
public void onRoutePresentationDisplayChanged(MediaRouter router, RouteInfo info) {
if (DEBUG) Log.d(TAG, "onRoutePresentationDisplayChanged: info=" + info);
- notifyIfChanged(() -> updateDisplays(mShowing));
+ updateDisplays(mShowing);
}
};
diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
index a07c5cb..6e06130 100644
--- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
@@ -96,11 +96,6 @@
int getBouncerPromptReason();
/**
- * Invoked when the secondary displays showing a keyguard window changes.
- */
- void onSecondaryDisplayShowingChanged(int[] displayId);
-
- /**
* Consumes a message that was enqueued to be displayed on the next time the bouncer shows up.
* @return Message that should be displayed above the challenge.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 66cfadf..172746e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -21,7 +21,6 @@
import static com.android.internal.telephony.IccCardConstants.State.ABSENT;
import static com.android.internal.telephony.IccCardConstants.State.PIN_REQUIRED;
import static com.android.internal.telephony.IccCardConstants.State.PUK_REQUIRED;
-import static com.android.internal.telephony.IccCardConstants.State.READY;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT;
@@ -95,7 +94,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Arrays;
/**
* Mediates requests related to the keyguard. This includes queries about the
@@ -247,9 +245,6 @@
// AOD is enabled and status bar is in AOD state.
private boolean mAodShowing;
- // display ids of the external display on which we have put a keyguard window
- private int[] mSecondaryDisplaysShowing;
-
/** Cached value of #isInputRestricted */
private boolean mInputRestricted;
@@ -687,13 +682,6 @@
mCustomMessage = null;
return message;
}
-
- @Override
- public void onSecondaryDisplayShowingChanged(int[] displayIds) {
- synchronized (KeyguardViewMediator.this) {
- setShowingLocked(mShowing, mAodShowing, displayIds, false);
- }
- }
};
public void userActivity() {
@@ -722,7 +710,7 @@
mContext.registerReceiver(mDelayedLockBroadcastReceiver, delayedActionFilter,
SYSTEMUI_PERMISSION, null /* scheduler */);
- mKeyguardDisplayManager = new KeyguardDisplayManager(mContext, mViewMediatorCallback);
+ mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
@@ -738,10 +726,10 @@
setShowingLocked(!shouldWaitForProvisioning()
&& !mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser()),
- mAodShowing, mSecondaryDisplaysShowing, true /* forceCallbacks */);
+ mAodShowing, true /* forceCallbacks */);
} else {
// The system's keyguard is disabled or missing.
- setShowingLocked(false, mAodShowing, mSecondaryDisplaysShowing, true);
+ setShowingLocked(false, mAodShowing, true);
}
mStatusBarKeyguardViewManager =
@@ -1764,12 +1752,10 @@
playSound(mTrustedSoundId);
}
- private void updateActivityLockScreenState(boolean showing, boolean aodShowing,
- int[] secondaryDisplaysShowing) {
+ private void updateActivityLockScreenState(boolean showing, boolean aodShowing) {
mUiOffloadThread.submit(() -> {
try {
- ActivityTaskManager.getService().setLockScreenShown(showing, aodShowing,
- secondaryDisplaysShowing);
+ ActivityTaskManager.getService().setLockScreenShown(showing, aodShowing);
} catch (RemoteException e) {
}
});
@@ -1892,8 +1878,7 @@
if (!mHiding) {
// Tell ActivityManager that we canceled the keyguardExitAnimation.
- setShowingLocked(mShowing, mAodShowing, mSecondaryDisplaysShowing,
- true /* force */);
+ setShowingLocked(mShowing, mAodShowing, true /* force */);
return;
}
mHiding = false;
@@ -2163,23 +2148,19 @@
}
private void setShowingLocked(boolean showing, boolean aodShowing) {
- setShowingLocked(showing, aodShowing, mSecondaryDisplaysShowing,
- false /* forceCallbacks */);
+ setShowingLocked(showing, aodShowing, false /* forceCallbacks */);
}
- private void setShowingLocked(boolean showing, boolean aodShowing,
- int[] secondaryDisplaysShowing, boolean forceCallbacks) {
+ private void setShowingLocked(boolean showing, boolean aodShowing, boolean forceCallbacks) {
final boolean notifyDefaultDisplayCallbacks = showing != mShowing
|| aodShowing != mAodShowing || forceCallbacks;
- if (notifyDefaultDisplayCallbacks
- || !Arrays.equals(secondaryDisplaysShowing, mSecondaryDisplaysShowing)) {
+ if (notifyDefaultDisplayCallbacks) {
mShowing = showing;
mAodShowing = aodShowing;
- mSecondaryDisplaysShowing = secondaryDisplaysShowing;
if (notifyDefaultDisplayCallbacks) {
notifyDefaultDisplayCallbacks(showing);
}
- updateActivityLockScreenState(showing, aodShowing, secondaryDisplaysShowing);
+ updateActivityLockScreenState(showing, aodShowing);
}
}