Loading core/java/android/os/Process.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,12 @@ public class Process { */ public static final int VPN_UID = 1016; /** * Defines the UID/GID for keystore. * @hide */ public static final int KEYSTORE_UID = 1017; /** * Defines the UID/GID for the NFC service process. * @hide Loading services/core/java/com/android/server/security/KeyAttestationApplicationIdProviderService.java +14 −6 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Binder; import android.os.RemoteException; import android.os.UserHandle; import android.security.keymaster.KeyAttestationPackageInfo; Loading @@ -45,14 +46,19 @@ public class KeyAttestationApplicationIdProviderService public KeyAttestationApplicationId getKeyAttestationApplicationId(int uid) throws RemoteException { if (Binder.getCallingUid() != android.os.Process.KEYSTORE_UID) { throw new SecurityException("This service can only be used by Keystore"); } KeyAttestationPackageInfo[] keyAttestationPackageInfos = null; final long token = Binder.clearCallingIdentity(); try { String[] packageNames = mPackageManager.getPackagesForUid(uid); if (packageNames == null) { throw new RemoteException("No packages for uid"); } int userId = UserHandle.getUserId(uid); KeyAttestationPackageInfo[] keyAttestationPackageInfos = new KeyAttestationPackageInfo[packageNames.length]; try { keyAttestationPackageInfos = new KeyAttestationPackageInfo[packageNames.length]; for (int i = 0; i < packageNames.length; ++i) { PackageInfo packageInfo = mPackageManager.getPackageInfoAsUser(packageNames[i], PackageManager.GET_SIGNATURES, userId); Loading @@ -61,6 +67,8 @@ public class KeyAttestationApplicationIdProviderService } } catch (NameNotFoundException nnfe) { throw new RemoteException(nnfe.getMessage()); } finally { Binder.restoreCallingIdentity(token); } return new KeyAttestationApplicationId(keyAttestationPackageInfos); } Loading Loading
core/java/android/os/Process.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,12 @@ public class Process { */ public static final int VPN_UID = 1016; /** * Defines the UID/GID for keystore. * @hide */ public static final int KEYSTORE_UID = 1017; /** * Defines the UID/GID for the NFC service process. * @hide Loading
services/core/java/com/android/server/security/KeyAttestationApplicationIdProviderService.java +14 −6 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Binder; import android.os.RemoteException; import android.os.UserHandle; import android.security.keymaster.KeyAttestationPackageInfo; Loading @@ -45,14 +46,19 @@ public class KeyAttestationApplicationIdProviderService public KeyAttestationApplicationId getKeyAttestationApplicationId(int uid) throws RemoteException { if (Binder.getCallingUid() != android.os.Process.KEYSTORE_UID) { throw new SecurityException("This service can only be used by Keystore"); } KeyAttestationPackageInfo[] keyAttestationPackageInfos = null; final long token = Binder.clearCallingIdentity(); try { String[] packageNames = mPackageManager.getPackagesForUid(uid); if (packageNames == null) { throw new RemoteException("No packages for uid"); } int userId = UserHandle.getUserId(uid); KeyAttestationPackageInfo[] keyAttestationPackageInfos = new KeyAttestationPackageInfo[packageNames.length]; try { keyAttestationPackageInfos = new KeyAttestationPackageInfo[packageNames.length]; for (int i = 0; i < packageNames.length; ++i) { PackageInfo packageInfo = mPackageManager.getPackageInfoAsUser(packageNames[i], PackageManager.GET_SIGNATURES, userId); Loading @@ -61,6 +67,8 @@ public class KeyAttestationApplicationIdProviderService } } catch (NameNotFoundException nnfe) { throw new RemoteException(nnfe.getMessage()); } finally { Binder.restoreCallingIdentity(token); } return new KeyAttestationApplicationId(keyAttestationPackageInfos); } Loading