Snap for 7687813 from 3c79aa579b to sc-v2-release
Change-Id: I4de40d0104688c69c0c91bb25bfdb8413f700f0a
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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))) {
|
||||
|
||||
Reference in New Issue
Block a user