Remove coarse location pre-grant for preinstalled VrListenerServices.
Bug: 28919229 Change-Id: I97393308129c65ef2822014775d3e77e25dc21e6
This commit is contained in:
@@ -218,7 +218,6 @@ public class VrManagerService extends SystemService implements EnabledComponentC
|
|||||||
String packageName = mNotificationAccessPackageToUserId.keyAt(i);
|
String packageName = mNotificationAccessPackageToUserId.keyAt(i);
|
||||||
revokeNotificationListenerAccess(packageName, grantUserId);
|
revokeNotificationListenerAccess(packageName, grantUserId);
|
||||||
revokeNotificationPolicyAccess(packageName);
|
revokeNotificationPolicyAccess(packageName);
|
||||||
revokeCoarseLocationPermissionIfNeeded(packageName, grantUserId);
|
|
||||||
mNotificationAccessPackageToUserId.removeAt(i);
|
mNotificationAccessPackageToUserId.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +226,6 @@ public class VrManagerService extends SystemService implements EnabledComponentC
|
|||||||
if (!packageNames.contains(pkg)) {
|
if (!packageNames.contains(pkg)) {
|
||||||
revokeNotificationListenerAccess(pkg, currentUserId);
|
revokeNotificationListenerAccess(pkg, currentUserId);
|
||||||
revokeNotificationPolicyAccess(pkg);
|
revokeNotificationPolicyAccess(pkg);
|
||||||
revokeCoarseLocationPermissionIfNeeded(pkg, currentUserId);
|
|
||||||
mNotificationAccessPackageToUserId.remove(pkg);
|
mNotificationAccessPackageToUserId.remove(pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +233,6 @@ public class VrManagerService extends SystemService implements EnabledComponentC
|
|||||||
if (!allowed.contains(pkg)) {
|
if (!allowed.contains(pkg)) {
|
||||||
grantNotificationPolicyAccess(pkg);
|
grantNotificationPolicyAccess(pkg);
|
||||||
grantNotificationListenerAccess(pkg, currentUserId);
|
grantNotificationListenerAccess(pkg, currentUserId);
|
||||||
grantCoarseLocationPermissionIfNeeded(pkg, currentUserId);
|
|
||||||
mNotificationAccessPackageToUserId.put(pkg, currentUserId);
|
mNotificationAccessPackageToUserId.put(pkg, currentUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -760,22 +757,6 @@ public class VrManagerService extends SystemService implements EnabledComponentC
|
|||||||
flatSettings, userId);
|
flatSettings, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grantCoarseLocationPermissionIfNeeded(String pkg, int userId) {
|
|
||||||
// Don't clobber the user if permission set in current state explicitly
|
|
||||||
if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) {
|
|
||||||
mContext.getPackageManager().grantRuntimePermission(pkg,
|
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void revokeCoarseLocationPermissionIfNeeded(String pkg, int userId) {
|
|
||||||
// Don't clobber the user if permission set in current state explicitly
|
|
||||||
if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) {
|
|
||||||
mContext.getPackageManager().revokeRuntimePermission(pkg,
|
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isPermissionUserUpdated(String permission, String pkg, int userId) {
|
private boolean isPermissionUserUpdated(String permission, String pkg, int userId) {
|
||||||
final int flags = mContext.getPackageManager().getPermissionFlags(
|
final int flags = mContext.getPackageManager().getPermissionFlags(
|
||||||
permission, pkg, new UserHandle(userId));
|
permission, pkg, new UserHandle(userId));
|
||||||
|
|||||||
Reference in New Issue
Block a user