Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a69c5fc authored by Rich Cannings's avatar Rich Cannings Committed by Android (Google) Code Review
Browse files

Merge "Added code to log the current value of the "allow unknown sources"...

Merge "Added code to log the current value of the "allow unknown sources" setting after successful package installation."
parents e1ee1265 f8a98ed4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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)


# ---------------------------
+15 −0
Original line number Diff line number Diff line
@@ -698,6 +698,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();
@@ -5458,6 +5462,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