Automatically grant location and body sensors permissions to
system packages that handle the com.android.fitness.TRACK intent. BUG: 31432884 Change-Id: I57ff470fe31ca6a3e824152b7b7eafd9759e3118
This commit is contained in:
@@ -152,6 +152,7 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
|
|
||||||
private static final String ACTION_TWINNING =
|
private static final String ACTION_TWINNING =
|
||||||
"com.google.android.clockwork.intent.TWINNING_SETTINGS";
|
"com.google.android.clockwork.intent.TWINNING_SETTINGS";
|
||||||
|
private static final String ACTION_TRACK = "com.android.fitness.TRACK";
|
||||||
|
|
||||||
private final PackageManagerService mService;
|
private final PackageManagerService mService;
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
@@ -606,9 +607,9 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
grantRuntimePermissionsLPw(musicPackage, STORAGE_PERMISSIONS, userId);
|
grantRuntimePermissionsLPw(musicPackage, STORAGE_PERMISSIONS, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android Wear
|
// Watches
|
||||||
if (mService.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) {
|
if (mService.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) {
|
||||||
// Android Wear Home
|
// Home application on watches
|
||||||
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
|
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
|
||||||
homeIntent.addCategory(Intent.CATEGORY_HOME_MAIN);
|
homeIntent.addCategory(Intent.CATEGORY_HOME_MAIN);
|
||||||
|
|
||||||
@@ -626,7 +627,7 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
userId);
|
userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android Wear Twinning
|
// Twinning on watches
|
||||||
Intent twinningIntent = new Intent(ACTION_TWINNING);
|
Intent twinningIntent = new Intent(ACTION_TWINNING);
|
||||||
PackageParser.Package twinningPackage = getDefaultSystemHandlerActivityPackageLPr(
|
PackageParser.Package twinningPackage = getDefaultSystemHandlerActivityPackageLPr(
|
||||||
twinningIntent, userId);
|
twinningIntent, userId);
|
||||||
@@ -636,6 +637,16 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
grantRuntimePermissionsLPw(twinningPackage, PHONE_PERMISSIONS, false, userId);
|
grantRuntimePermissionsLPw(twinningPackage, PHONE_PERMISSIONS, false, userId);
|
||||||
grantRuntimePermissionsLPw(twinningPackage, SMS_PERMISSIONS, false, userId);
|
grantRuntimePermissionsLPw(twinningPackage, SMS_PERMISSIONS, false, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fitness tracking on watches
|
||||||
|
Intent trackIntent = new Intent(ACTION_TRACK);
|
||||||
|
PackageParser.Package trackPackage = getDefaultSystemHandlerActivityPackageLPr(
|
||||||
|
trackIntent, userId);
|
||||||
|
if (trackPackage != null
|
||||||
|
&& doesPackageSupportRuntimePermissions(trackPackage)) {
|
||||||
|
grantRuntimePermissionsLPw(trackPackage, SENSORS_PERMISSIONS, false, userId);
|
||||||
|
grantRuntimePermissionsLPw(trackPackage, LOCATION_PERMISSIONS, false, userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print Spooler
|
// Print Spooler
|
||||||
|
|||||||
Reference in New Issue
Block a user