Merge "Register/unregister all apps system action with accessibility" into ub-launcher3-master

This commit is contained in:
Winson Chung
2020-03-05 01:24:03 +00:00
committed by Android (Google) Code Review
3 changed files with 110 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import android.os.CancellationSignal;
import com.android.launcher3.LauncherState.ScaleAndTranslation;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.accessibility.SystemActions;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.popup.SystemShortcut;
@@ -62,6 +63,8 @@ import java.util.stream.Stream;
public abstract class BaseQuickstepLauncher extends Launcher
implements NavigationModeChangeListener {
protected SystemActions mSystemActions;
/**
* Reusable command for applying the back button alpha on the background thread.
*/
@@ -74,6 +77,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSystemActions = new SystemActions(this);
SysUINavigationMode.Mode mode = SysUINavigationMode.INSTANCE.get(this)
.addModeChangeListener(this);
@@ -131,6 +135,12 @@ public abstract class BaseQuickstepLauncher extends Launcher
getRotationHelper().setRotationHadDifferentUI(newMode != Mode.NO_BUTTON);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mSystemActions.onActivityResult(requestCode);
}
@Override
public void onEnterAnimationComplete() {
super.onEnterAnimationComplete();
@@ -188,6 +198,15 @@ public abstract class BaseQuickstepLauncher extends Launcher
// removes the task itself.
startActivity(ProxyActivityStarter.getLaunchIntent(this, null));
}
// Register all system actions once they are available
mSystemActions.register();
}
@Override
protected void onPause() {
super.onPause();
mSystemActions.unregister();
}
@Override