f26d98e870
Test: Manual
Bug:112282235 P3 Starting an app from Launcher very rarely takes > 10 sec
Bug:121279417 P2 Why LauncherInstrumentation.WAIT_TIME_MS == 60000?
Bug:123892607 P1 Test broken: WellbeingTests.testPauseAppFromAllApps
Bug:123900446 P1 App to home animation should zoom into the app icon
Bug:125844074 P2 Final UX and animations for Launcher DWB integration
Bug:131360075 P1 [Gesture Nav] Polish/finish landscape
Bug:131698989 P2 Add task callback for locked state change
Bug:131741395 P2 Allow windows to scale/move past overview positioning
Bug:131768436 P1 Bad placement of search bar
Bug:131854153 P1 Lots of Cuttlefish (and not only) tests are broken
Bug:131867841 P1 Changing display size does not update the grid
Bug:132460627 P1 Unable to swipe to all apps screen on devices
Bug:132687470 P1 Swiping home from forced landscape app creates cutoff task thumbnail
Bug:132756514 P1 Sometimes (when quick switching?) user gets stuck in full-screen recents view
Bug:132900132 P1 Apparently, tests start running while provisioning is still in progress
Bug:132917885 P1 Reduce swipe-up gesture region height in landscape
Bug:132975416 P1 Flake in NexusPredictionAppTracker.getAppPredictionContextExtras
Bug:132993129 P1 If predictions disabled, app predictions loading bar appears briefly on device restart
Bug:133113732 P1 [B1/C1][QT][CTS_Verifier_9.0_r1]Device Owner Tests-LockTask UI-Enable Overview button failure
Bug:133167096 P1 It is way too easy to dismiss apps from the lock screen
Bug:133651528 P1 [QT]"Pixel Launcher isn't responding" dialog pop up ,after DUT restored.
Bug:133765434 P1 [Flaky test] Launching task didn't open a new window
Bug:133765491 P1 App docked in split screen flickers with emptiness observed while rotating the device
Bug:133783088 P1 Footer showing up on all overview task snapshots even with no items showing.
Bug:133867119 P2 Lab-only flake: want to switch from workspace to all apps; Swipe failed to receive an event for the swipe end
Bug:64712476 P3 Import translations for dev branches
Change-Id: Ib4bcefdbb4027992e75e2742d72f199e13467875
(cherry picked from commit 0ef6fe00b0)
146 lines
5.0 KiB
Java
146 lines
5.0 KiB
Java
/*
|
|
* Copyright (C) 2018 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.quickstep;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.os.RemoteException;
|
|
import android.util.Log;
|
|
|
|
import com.android.launcher3.Utilities;
|
|
import com.android.launcher3.allapps.DiscoveryBounce;
|
|
import com.android.launcher3.util.MainThreadInitializedObject;
|
|
import com.android.launcher3.util.UiThreadHelper;
|
|
import com.android.systemui.shared.recents.ISystemUiProxy;
|
|
|
|
import androidx.annotation.WorkerThread;
|
|
|
|
/**
|
|
* Sets alpha for the back button
|
|
*/
|
|
public class OverviewInteractionState {
|
|
|
|
private static final String TAG = "OverviewFlags";
|
|
|
|
private static final String HAS_ENABLED_QUICKSTEP_ONCE = "launcher.has_enabled_quickstep_once";
|
|
|
|
// We do not need any synchronization for this variable as its only written on UI thread.
|
|
public static final MainThreadInitializedObject<OverviewInteractionState> INSTANCE =
|
|
new MainThreadInitializedObject<>(OverviewInteractionState::new);
|
|
|
|
private static final int MSG_SET_PROXY = 200;
|
|
private static final int MSG_SET_BACK_BUTTON_ALPHA = 201;
|
|
|
|
private final Context mContext;
|
|
private final Handler mUiHandler;
|
|
private final Handler mBgHandler;
|
|
|
|
// These are updated on the background thread
|
|
private ISystemUiProxy mISystemUiProxy;
|
|
private float mBackButtonAlpha = 1;
|
|
|
|
private int mSystemUiStateFlags;
|
|
|
|
private OverviewInteractionState(Context context) {
|
|
mContext = context;
|
|
|
|
// Data posted to the uihandler will be sent to the bghandler. Data is sent to uihandler
|
|
// because of its high send frequency and data may be very different than the previous value
|
|
// For example, send back alpha on uihandler to avoid flickering when setting its visibility
|
|
mUiHandler = new Handler(this::handleUiMessage);
|
|
mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
|
|
|
|
onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context)
|
|
.addModeChangeListener(this::onNavigationModeChanged));
|
|
}
|
|
|
|
public float getBackButtonAlpha() {
|
|
return mBackButtonAlpha;
|
|
}
|
|
|
|
public void setBackButtonAlpha(float alpha, boolean animate) {
|
|
if (!modeSupportsGestures()) {
|
|
alpha = 1;
|
|
}
|
|
mUiHandler.removeMessages(MSG_SET_BACK_BUTTON_ALPHA);
|
|
mUiHandler.obtainMessage(MSG_SET_BACK_BUTTON_ALPHA, animate ? 1 : 0, 0, alpha)
|
|
.sendToTarget();
|
|
}
|
|
|
|
public void setSystemUiProxy(ISystemUiProxy proxy) {
|
|
mBgHandler.obtainMessage(MSG_SET_PROXY, proxy).sendToTarget();
|
|
}
|
|
|
|
public void setSystemUiStateFlags(int stateFlags) {
|
|
mSystemUiStateFlags = stateFlags;
|
|
}
|
|
|
|
public int getSystemUiStateFlags() {
|
|
return mSystemUiStateFlags;
|
|
}
|
|
|
|
private boolean handleUiMessage(Message msg) {
|
|
if (msg.what == MSG_SET_BACK_BUTTON_ALPHA) {
|
|
mBackButtonAlpha = (float) msg.obj;
|
|
}
|
|
mBgHandler.obtainMessage(msg.what, msg.arg1, msg.arg2, msg.obj).sendToTarget();
|
|
return true;
|
|
}
|
|
|
|
private boolean handleBgMessage(Message msg) {
|
|
switch (msg.what) {
|
|
case MSG_SET_PROXY:
|
|
mISystemUiProxy = (ISystemUiProxy) msg.obj;
|
|
break;
|
|
case MSG_SET_BACK_BUTTON_ALPHA:
|
|
applyBackButtonAlpha((float) msg.obj, msg.arg1 == 1);
|
|
return true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@WorkerThread
|
|
private void applyBackButtonAlpha(float alpha, boolean animate) {
|
|
if (mISystemUiProxy == null) {
|
|
return;
|
|
}
|
|
try {
|
|
mISystemUiProxy.setBackButtonAlpha(alpha, animate);
|
|
} catch (RemoteException e) {
|
|
Log.w(TAG, "Unable to update overview back button alpha", e);
|
|
}
|
|
}
|
|
|
|
private void onNavigationModeChanged(SysUINavigationMode.Mode mode) {
|
|
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
|
}
|
|
|
|
private void resetHomeBounceSeenOnQuickstepEnabledFirstTime() {
|
|
if (modeSupportsGestures() && !Utilities.getPrefs(mContext).getBoolean(
|
|
HAS_ENABLED_QUICKSTEP_ONCE, true)) {
|
|
Utilities.getPrefs(mContext).edit()
|
|
.putBoolean(HAS_ENABLED_QUICKSTEP_ONCE, true)
|
|
.putBoolean(DiscoveryBounce.HOME_BOUNCE_SEEN, false)
|
|
.apply();
|
|
}
|
|
}
|
|
|
|
private boolean modeSupportsGestures() {
|
|
return SysUINavigationMode.getMode(mContext).hasGestures;
|
|
}
|
|
}
|