Filter out user handle in ST package check
Only the app id part of uid matters in checking against the uid associated with a package from package manager. Bug: 281778398 Test: agsa/as smoke + user switch tests Change-Id: I8e00f95c5e2d756ef256828d6360c9f7e3226c10
This commit is contained in:
@@ -366,10 +366,10 @@ public class SoundTriggerService extends SystemService {
|
||||
try {
|
||||
int uid = mPackageManager.getPackageUid(mOriginatorIdentity.packageName,
|
||||
PackageManager.PackageInfoFlags.of(0));
|
||||
if (uid != mOriginatorIdentity.uid) {
|
||||
throw new SecurityException("Package name: " +
|
||||
mOriginatorIdentity.packageName + "with uid: " + uid
|
||||
+ "attempted to spoof as: " + mOriginatorIdentity.uid);
|
||||
if (!UserHandle.isSameApp(uid, mOriginatorIdentity.uid)) {
|
||||
throw new SecurityException("Uid " + mOriginatorIdentity.uid +
|
||||
" attempted to spoof package name " +
|
||||
mOriginatorIdentity.packageName + " with uid: " + uid);
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new SecurityException("Package name not found: "
|
||||
|
||||
Reference in New Issue
Block a user