Launching touchpad tutorial as user 0
It's required to properly intercept touchpad gestures which is happening in process of user 0. By default activity was launched in the current user process. Also targeting sysui package directly with intent. Bug: 361518125 Test: launch touchpad tutorial with HSUM and see touchpad gestures intercepted Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial Change-Id: I904df93758e49a7b10cf6d7a5398550405daafbb
This commit is contained in:
@@ -21,11 +21,13 @@ import static com.android.systemui.shared.Flags.newTouchpadGesturesTutorial;
|
|||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
@@ -79,10 +81,12 @@ public class TouchGesturesButtonPreferenceController extends BasePreferenceContr
|
|||||||
private void showTouchpadGestureEducation() {
|
private void showTouchpadGestureEducation() {
|
||||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_LEARN_TOUCHPAD_GESTURE_CLICK);
|
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_LEARN_TOUCHPAD_GESTURE_CLICK);
|
||||||
if (newTouchpadGesturesTutorial()) {
|
if (newTouchpadGesturesTutorial()) {
|
||||||
Intent intent = new Intent(TUTORIAL_ACTION);
|
Intent intent = new Intent(TUTORIAL_ACTION)
|
||||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
.setPackage(Utils.SYSTEMUI_PACKAGE_NAME);
|
||||||
mContext.startActivity(intent);
|
// touchpad tutorial must be started as system user as it needs to have access to state
|
||||||
|
// of user 0 sysui instance
|
||||||
|
mContext.startActivityAsUser(intent, UserHandle.SYSTEM);
|
||||||
} else {
|
} else {
|
||||||
TrackpadGestureDialogFragment fragment = new TrackpadGestureDialogFragment();
|
TrackpadGestureDialogFragment fragment = new TrackpadGestureDialogFragment();
|
||||||
fragment.setTargetFragment(mParent, 0);
|
fragment.setTargetFragment(mParent, 0);
|
||||||
|
Reference in New Issue
Block a user