diff options
Diffstat (limited to 'src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java')
-rw-r--r-- | src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java index efb05a4..9e27147 100644 --- a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java +++ b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.Signature; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; @@ -195,14 +196,30 @@ public class PrivacyGuardManager extends Fragment */ private List<AppInfo> loadInstalledApps() { List<AppInfo> apps = new ArrayList<AppInfo>(); - List<PackageInfo> packages = mPm.getInstalledPackages(PackageManager.GET_PERMISSIONS); + List<PackageInfo> packages = mPm.getInstalledPackages( + PackageManager.GET_PERMISSIONS | PackageManager.GET_SIGNATURES); boolean showSystemApps = shouldShowSystemApps(); boolean filterByPermission = shouldFilterByPermission(); + Signature platformCert; + + try { + PackageInfo sysInfo = mPm.getPackageInfo("android", PackageManager.GET_SIGNATURES); + platformCert = sysInfo.signatures[0]; + } catch (PackageManager.NameNotFoundException e) { + platformCert = null; + } for (PackageInfo info : packages) { final ApplicationInfo appInfo = info.applicationInfo; - // skip system apps if they shall not be included + // hide apps signed with the platform certificate to avoid the user + // shooting himself in the foot + if (platformCert != null && info.signatures != null + && platformCert.equals(info.signatures[0])) { + continue; + } + + // skip all system apps if they shall not be included if (!showSystemApps && (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { continue; } |