diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 0afa480667..b7c5db2f17 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -123,11 +123,9 @@ public class TaskbarDragLayerController { */ public void updateInsetsTouchability(InsetsInfo insetsInfo) { insetsInfo.touchableRegion.setEmpty(); - if (mActivity.isThreeButtonNav()) { - // Always have nav buttons be touchable - mControllers.navbarButtonsViewController.addVisibleButtonsRegion( - mTaskbarDragLayer, insetsInfo.touchableRegion); - } + // Always have nav buttons be touchable + mControllers.navbarButtonsViewController.addVisibleButtonsRegion( + mTaskbarDragLayer, insetsInfo.touchableRegion); if (mTaskbarDragLayer.getAlpha() < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) { // Let touches pass through us. diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index c2c721adf8..1cf50f7f64 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -71,7 +71,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { } } activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); + activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY); Object itemInfo = hostView.getTag(); if (itemInfo instanceof ItemInfo) { mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options); diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index f420ec2f08..9c61c1b69f 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -454,7 +454,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mAllAppsStore.unregisterIconContainer(mAH[AdapterHolder.WORK].recyclerView); if (mUsingTabs) { - setupWorkToggle(); mAH[AdapterHolder.MAIN].setup(mViewPager.getChildAt(0), mPersonalMatcher); mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher); mAH[AdapterHolder.WORK].recyclerView.setId(R.id.apps_list_view_work); @@ -485,6 +484,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } private void setupWorkToggle() { + removeWorkToggle(); if (Utilities.ATLEAST_P) { mWorkModeSwitch = (WorkModeSwitch) mLauncher.getLayoutInflater().inflate( R.layout.work_mode_fab, this, false); @@ -497,6 +497,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } } + private void removeWorkToggle() { + if (mWorkModeSwitch == null) return; + if (mWorkModeSwitch.getParent() == this) { + this.removeView(mWorkModeSwitch); + } + mWorkModeSwitch = null; + } + private void replaceRVContainer(boolean showTabs) { for (int i = 0; i < mAH.length; i++) { AllAppsRecyclerView rv = mAH[i].recyclerView; @@ -519,8 +527,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mViewPager = (AllAppsPagedView) newView; mViewPager.initParentViews(this); mViewPager.getPageIndicator().setOnActivePageChangedListener(this); + setupWorkToggle(); } else { mViewPager = null; + removeWorkToggle(); } } @@ -539,14 +549,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mWorkModeSwitch.setWorkTabVisible(currentActivePage == AdapterHolder.WORK && mAllAppsStore.hasModelFlag( FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)); - - if (currentActivePage == AdapterHolder.WORK) { - if (mWorkModeSwitch.getParent() == null) { - addView(mWorkModeSwitch); - } - } else { - removeView(mWorkModeSwitch); - } } } diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index a800d34758..5d3af08b46 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -51,6 +51,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Nullable private KeyboardInsetAnimationCallback mKeyboardInsetAnimationCallback; + private boolean mWorkTabVisible; public WorkModeSwitch(Context context) { this(context, null, 0); @@ -91,11 +92,10 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi */ public void setWorkTabVisible(boolean workTabVisible) { clearAnimation(); - if (workTabVisible) { + mWorkTabVisible = workTabVisible; + if (workTabVisible && mWorkEnabled) { setEnabled(true); - if (mWorkEnabled) { - setVisibility(VISIBLE); - } + setVisibility(VISIBLE); setAlpha(0); animate().alpha(1).start(); } else { @@ -105,7 +105,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public void onClick(View view) { - if (Utilities.ATLEAST_P) { + if (Utilities.ATLEAST_P && mWorkTabVisible) { setEnabled(false); Launcher.fromContext(getContext()).getStatsLogManager().logger().log( LAUNCHER_TURN_OFF_WORK_APPS_TAP); @@ -137,7 +137,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { - if (Utilities.ATLEAST_R) { + if (Utilities.ATLEAST_R && mWorkTabVisible) { setTranslationY(0); if (insets.isVisible(WindowInsets.Type.ime())) { Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime()); diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java index fae55cc0cc..f9a9997e99 100644 --- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java +++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java @@ -15,6 +15,7 @@ import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runners.model.Statement; +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -66,15 +67,18 @@ public class FailureWatcher extends TestWatcher { onError(mDevice, description, e); } + static File diagFile(Description description, String prefix, String ext) { + return new File(getInstrumentation().getTargetContext().getFilesDir(), + prefix + "-" + description.getTestClass().getSimpleName() + "." + + description.getMethodName() + "." + ext); + } + public static void onError(UiDevice device, Description description, Throwable e) { Log.d("b/196820244", "onError 1"); if (device == null) return; Log.d("b/196820244", "onError 2"); - final File parentFile = getInstrumentation().getTargetContext().getFilesDir(); - final File sceenshot = new File(parentFile, - "TestScreenshot-" + description.getMethodName() + ".png"); - final File hierarchy = new File(parentFile, - "Hierarchy-" + description.getMethodName() + ".zip"); + final File sceenshot = diagFile(description, "TestScreenshot", "png"); + final File hierarchy = diagFile(description, "Hierarchy", "zip"); // Dump window hierarchy try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(hierarchy))) { @@ -97,13 +101,13 @@ public class FailureWatcher extends TestWatcher { device.takeScreenshot(sceenshot); // Dump accessibility hierarchy - final File accessibilityHierarchyFile = new File(parentFile, - "AccessibilityHierarchy-" + description.getMethodName() + ".uix"); try { - device.dumpWindowHierarchy(accessibilityHierarchyFile); + device.dumpWindowHierarchy(diagFile(description, "AccessibilityHierarchy", "uix")); } catch (IOException ex) { Log.e(TAG, "Failed to save accessibility hierarchy", ex); } + + dumpCommand("logcat -d -s TestRunner", diagFile(description, "FilteredLogcat", "txt")); } private static void dumpStringCommand(String cmd, OutputStream out) throws IOException { @@ -111,6 +115,14 @@ public class FailureWatcher extends TestWatcher { dumpCommand(cmd, out); } + private static void dumpCommand(String cmd, File out) { + try (BufferedOutputStream buffered = new BufferedOutputStream( + new FileOutputStream(out))) { + dumpCommand(cmd, buffered); + } catch (IOException ex) { + } + } + private static void dumpCommand(String cmd, OutputStream out) throws IOException { try (AutoCloseInputStream in = new AutoCloseInputStream(getInstrumentation() .getUiAutomation().executeShellCommand(cmd))) {