diff options
author | Lars Greiss <kufikugel@googlemail.com> | 2013-07-03 22:44:11 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2013-07-04 15:47:47 +0200 |
commit | 943c2686c5e8595c286f2bb8a926d6798c563657 (patch) | |
tree | 0a65412ac0f58848faf68c927b04e44493df6b7c /src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java | |
parent | 4df4c3e727ce0820169bff5807da30ed2348c27f (diff) | |
download | packages_apps_settings-943c2686c5e8595c286f2bb8a926d6798c563657.zip packages_apps_settings-943c2686c5e8595c286f2bb8a926d6798c563657.tar.gz packages_apps_settings-943c2686c5e8595c286f2bb8a926d6798c563657.tar.bz2 |
Settings: privacy Guard enhance app logic
This commit changes the following
- do not show apps signed with the plaform certificate at all
(like settings, systemUI, android system etc)
IMO the user should trust the android signed apps to be save and this will
prevent weird behaviours user can get when they activate it on this packages
all other system apps (like calculator, browser) and all which are not signed with
android key are not effected.
- to go inline with AOSP disable the checkbox in detail app screen
for built in apps
cheers
SlimRoms
Change-Id: I12b5522f6e58047173778381fb7290bb1c71bab3
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; } |