Added code to log the current value of the "allow unknown sources" setting after

successful package installation.

Change-Id: Id8de7ae94e3b3b68e033c24649ca67324d894ce8
This commit is contained in:
Matt Finifter
2012-05-14 15:43:34 -07:00
parent 444805e389
commit f8a98ed4e1
2 changed files with 17 additions and 0 deletions

View File

@@ -114,6 +114,8 @@ option java_package com.android.server
# Package Manager ready:
3100 boot_progress_pms_ready (time|2|3)
# + check activity_launch_time for Home app
# Value of "unknown sources" setting at app install time
3110 unknown_sources_enabled (value|1)
# ---------------------------

View File

@@ -688,6 +688,10 @@ public class PackageManagerService extends IPackageManager.Stub {
// Remove the replaced package's older resources safely now
deleteOld = true;
}
// Log current value of "unknown sources" setting
EventLog.writeEvent(EventLogTags.UNKNOWN_SOURCES_ENABLED,
getUnknownSourcesSettings());
}
// Force a gc to clear up things
Runtime.getRuntime().gc();
@@ -5407,6 +5411,17 @@ public class PackageManagerService extends IPackageManager.Stub {
DEFAULT_VERIFY_ENABLE ? 1 : 0) == 1 ? true : false;
}
/**
* Get the "allow unknown sources" setting.
*
* @return the current "allow unknown sources" setting
*/
private int getUnknownSourcesSettings() {
return android.provider.Settings.Secure.getInt(mContext.getContentResolver(),
android.provider.Settings.Secure.INSTALL_NON_MARKET_APPS,
-1);
}
public void setInstallerPackageName(String targetPackage, String installerPackageName) {
final int uid = Binder.getCallingUid();
// writer