Revert^2 "Restrict nav mode UI checks within primary display"
This reverts commit 9d7b814eec.
Reason for revert: Cache the taskbar primary display to reduce the number of binder calls and calm down Droidmonitor. Please check the difference between PS1 and PS2.
Bug: 414092022
Bug: 413244466
Bug: 408631713
Change-Id: I24138de2e2b9975fadcdf4a27402e06e212e4a19
This commit is contained in:
1 parent
9d7b814eec
commit
d1a0e640cb
6 files changed
+40
-4
No files matched your search
@@ -79,5 +79,7 @@ interface TaskbarManager : SystemDecorationChangeObserver.DisplayDecorationListe
|
||||
|
||||
fun createAllAppsPendingIntent(): PendingIntent
|
||||
|
||||
fun getPrimaryDisplayId(): Int
|
||||
|
||||
fun debugPrimaryTaskbar(debugReason: String, verbose: Boolean)
|
||||
}
|
||||
@@ -1686,6 +1686,13 @@ public class TaskbarManagerImpl implements DisplayDecorationListener {
|
||||
return SystemUiProxy.INSTANCE.get(mBaseContext).getFocusState().getFocusedDisplayId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary display id associated with this manager.
|
||||
*/
|
||||
public int getPrimaryDisplayId() {
|
||||
return mPrimaryDisplayId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs debug information about the TaskbarManager for primary display.
|
||||
* @param debugReason A string describing the reason for the debug log.
|
||||
|
||||
@@ -261,6 +261,11 @@ class TaskbarManagerImplWrapper(private val impl: TaskbarManagerImpl) : TaskbarM
|
||||
)
|
||||
}
|
||||
|
||||
override fun getPrimaryDisplayId(): Int {
|
||||
// Thread safe
|
||||
return impl.getPrimaryDisplayId()
|
||||
}
|
||||
|
||||
override fun dumpLogs(prefix: String, pw: PrintWriter) {
|
||||
// Stay on caller thread because PrinterWriter is not thread safe.
|
||||
impl.dumpLogs(prefix, pw)
|
||||
|
||||
@@ -198,6 +198,10 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
case TestProtocol.REQUEST_EJECT_FAKE_TRACKPAD:
|
||||
runOnTISBinder(tisBinder -> tisBinder.ejectFakeTrackpadForTesting());
|
||||
return response;
|
||||
case TestProtocol.REQUEST_TASKBAR_PRIMARY_DISPLAY_ID: {
|
||||
return getTISBinderUIProperty(Bundle::putInt, tisBinder ->
|
||||
tisBinder.getTaskbarManager().getPrimaryDisplayId());
|
||||
}
|
||||
}
|
||||
|
||||
return super.call(method, arg, extras);
|
||||
|
||||
@@ -179,6 +179,8 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_INJECT_FAKE_TRACKPAD = "inject-fake-trackpad";
|
||||
public static final String REQUEST_EJECT_FAKE_TRACKPAD = "eject-fake-trackpad";
|
||||
|
||||
public static final String REQUEST_TASKBAR_PRIMARY_DISPLAY_ID = "taskbar-primary-display-id";
|
||||
|
||||
/** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */
|
||||
public static void testLogD(String tag, String message) {
|
||||
if (!sDebugTracing) {
|
||||
|
||||
@@ -213,6 +213,8 @@ public final class LauncherInstrumentation {
|
||||
|
||||
private boolean mWaitingForMotionUpEvent;
|
||||
|
||||
private final Integer taskbarPrimaryDisplayId;
|
||||
|
||||
private static Pattern getKeyEventPattern(String action, String keyCode) {
|
||||
return Pattern.compile("Key event: KeyEvent.*action=" + action + ".*keyCode=" + keyCode);
|
||||
}
|
||||
@@ -326,6 +328,8 @@ public final class LauncherInstrumentation {
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
taskbarPrimaryDisplayId = getTaskbarPrimaryDisplayId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,6 +465,11 @@ public final class LauncherInstrumentation {
|
||||
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
Integer getTaskbarPrimaryDisplayId() {
|
||||
final Bundle testInfo = getTestInfo(TestProtocol.REQUEST_TASKBAR_PRIMARY_DISPLAY_ID);
|
||||
return testInfo != null ? testInfo.getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD) : null;
|
||||
}
|
||||
|
||||
void setActiveContainer(VisibleContainer container) {
|
||||
sActiveContainer = new WeakReference<>(container);
|
||||
}
|
||||
@@ -874,22 +883,29 @@ public final class LauncherInstrumentation {
|
||||
final int waitTime = waitForCorrectState ? WAIT_TIME_MS : 0;
|
||||
final NavigationModel navigationModel = getNavigationModel();
|
||||
String resPackage = getNavigationButtonResPackage();
|
||||
final BySelector recentAppsSelector = By.res(resPackage, "recent_apps");
|
||||
final BySelector homeSelector = By.res(resPackage, "home");
|
||||
if (taskbarPrimaryDisplayId != null) {
|
||||
recentAppsSelector.displayId(taskbarPrimaryDisplayId);
|
||||
homeSelector.displayId(taskbarPrimaryDisplayId);
|
||||
}
|
||||
|
||||
if (navigationModel == NavigationModel.THREE_BUTTON) {
|
||||
if (!mDevice.wait(Until.hasObject(By.res(resPackage, "recent_apps")), waitTime)) {
|
||||
if (!mDevice.wait(Until.hasObject(recentAppsSelector), waitTime)) {
|
||||
return "Recents button not present in 3-button mode";
|
||||
}
|
||||
} else {
|
||||
if (!mDevice.wait(Until.gone(By.res(resPackage, "recent_apps")), waitTime)) {
|
||||
if (!mDevice.wait(Until.gone(recentAppsSelector), waitTime)) {
|
||||
return "Recents button is present in non-3-button mode";
|
||||
}
|
||||
}
|
||||
|
||||
if (navigationModel == NavigationModel.ZERO_BUTTON) {
|
||||
if (!mDevice.wait(Until.gone(By.res(resPackage, "home")), waitTime)) {
|
||||
if (!mDevice.wait(Until.gone(homeSelector), waitTime)) {
|
||||
return "Home button is present in gestural mode";
|
||||
}
|
||||
} else {
|
||||
if (!mDevice.wait(Until.hasObject(By.res(resPackage, "home")), waitTime)) {
|
||||
if (!mDevice.wait(Until.hasObject(homeSelector), waitTime)) {
|
||||
return "Home button not present in non-gestural mode";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user