Register/unregister all apps system action with accessibility

Bug: 136286274
Change-Id: Ia43d30b7cf078f56cc9887c8b3fb31924ad2b1b0
This commit is contained in:
Hongming Jin
2020-01-27 16:23:03 -08:00
committed by Winson Chung
parent 0ae6433a61
commit d91cb6e75f
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