MotoActions: Specify a qualified user for start activity
Fixes warning: ContextImpl: Calling a method in the system process without a qualified user Change-Id: I9352fc85adfacebcf535dfc2b5328dd07476cdb6
This commit is contained in:
parent
a95471f870
commit
8a96ebc5a1
@ -25,6 +25,7 @@ import android.content.pm.ActivityInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.VibrationEffect;
|
import android.os.VibrationEffect;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
@ -78,7 +79,7 @@ public class CameraActivationAction implements SensorAction {
|
|||||||
Intent intent = createIntent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
Intent intent = createIntent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
||||||
if (getBestActivityInfo(intent) != null) {
|
if (getBestActivityInfo(intent) != null) {
|
||||||
// Only launch if we can succeed, but let the user pick the action
|
// Only launch if we can succeed, but let the user pick the action
|
||||||
mContext.startActivity(intent);
|
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ public class CameraActivationAction implements SensorAction {
|
|||||||
ActivityInfo secureActivity = getBestActivityInfo(secureIntent, normalActivity);
|
ActivityInfo secureActivity = getBestActivityInfo(secureIntent, normalActivity);
|
||||||
if (secureActivity != null) {
|
if (secureActivity != null) {
|
||||||
secureIntent.setComponent(componentName(secureActivity));
|
secureIntent.setComponent(componentName(secureActivity));
|
||||||
mContext.startActivity(secureIntent);
|
mContext.startActivityAsUser(secureIntent, UserHandle.CURRENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user