Loading services/core/java/com/android/server/pm/PermissionsState.java +2 −2 Original line number Diff line number Diff line Loading @@ -381,10 +381,10 @@ public final class PermissionsState { * * @return The gids for all device users. */ public int[] computeGids() { public int[] computeGids(int[] userIds) { int[] gids = mGlobalGids; for (int userId : UserManagerService.getInstance().getUserIds()) { for (int userId : userIds) { final int[] userGids = computeGids(userId); gids = appendInts(gids, userGids); } Loading services/core/java/com/android/server/pm/Settings.java +97 −76 Original line number Diff line number Diff line Loading @@ -2022,14 +2022,53 @@ final class Settings { |FileUtils.S_IRGRP|FileUtils.S_IWGRP, -1, -1); writePackageListLPr(); writeAllUsersPackageRestrictionsLPr(); writeAllRuntimePermissionsLPr(); return; } catch(XmlPullParserException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } catch(java.io.IOException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } // Clean up partially written files if (mSettingsFilename.exists()) { if (!mSettingsFilename.delete()) { Slog.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename); } } //Debug.stopMethodTracing(); } void writePackageListLPr() { writePackageListLPr(-1); } void writePackageListLPr(int creatingUserId) { // Only derive GIDs for active users (not dying) final List<UserInfo> users = UserManagerService.getInstance().getUsers(true); int[] userIds = new int[users.size()]; for (int i = 0; i < userIds.length; i++) { userIds[i] = users.get(i).id; } if (creatingUserId != -1) { userIds = ArrayUtils.appendInt(userIds, creatingUserId); } // Write package list file now, use a JournaledFile. File tempFile = new File(mPackageListFilename.getAbsolutePath() + ".tmp"); JournaledFile journal = new JournaledFile(mPackageListFilename, tempFile); final File writeTarget = journal.chooseForWrite(); FileOutputStream fstr = null; BufferedOutputStream str = null; try { fstr = new FileOutputStream(writeTarget); str = new BufferedOutputStream(fstr); try { FileUtils.setPermissions(fstr.getFD(), 0640, SYSTEM_UID, PACKAGE_INFO_GID); StringBuilder sb = new StringBuilder(); Loading @@ -2042,7 +2081,7 @@ final class Settings { final ApplicationInfo ai = pkg.pkg.applicationInfo; final String dataPath = ai.dataDir; final boolean isDebug = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; final int[] gids = pkg.getPermissionsState().computeGids(); final int[] gids = pkg.getPermissionsState().computeGids(userIds); // Avoid any application that has a space in its path. if (dataPath.indexOf(" ") >= 0) Loading Loading @@ -2096,27 +2135,6 @@ final class Settings { IoUtils.closeQuietly(str); journal.rollback(); } writeAllUsersPackageRestrictionsLPr(); writeAllRuntimePermissionsLPr(); return; } catch(XmlPullParserException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } catch(java.io.IOException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } // Clean up partially written files if (mSettingsFilename.exists()) { if (!mSettingsFilename.delete()) { Slog.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename); } } //Debug.stopMethodTracing(); } void writeDisabledSysPackageLPr(XmlSerializer serializer, final PackageSetting pkg) Loading Loading @@ -3491,6 +3509,7 @@ final class Settings { } readDefaultPreferredAppsLPw(service, userHandle); writePackageRestrictionsLPr(userHandle); writePackageListLPr(userHandle); } void removeUserLPw(int userId) { Loading @@ -3506,6 +3525,8 @@ final class Settings { removeCrossProfileIntentFiltersLPw(userId); mRuntimePermissionsPersistence.onUserRemoved(userId); writePackageListLPr(); } void removeCrossProfileIntentFiltersLPw(int userId) { Loading Loading
services/core/java/com/android/server/pm/PermissionsState.java +2 −2 Original line number Diff line number Diff line Loading @@ -381,10 +381,10 @@ public final class PermissionsState { * * @return The gids for all device users. */ public int[] computeGids() { public int[] computeGids(int[] userIds) { int[] gids = mGlobalGids; for (int userId : UserManagerService.getInstance().getUserIds()) { for (int userId : userIds) { final int[] userGids = computeGids(userId); gids = appendInts(gids, userGids); } Loading
services/core/java/com/android/server/pm/Settings.java +97 −76 Original line number Diff line number Diff line Loading @@ -2022,14 +2022,53 @@ final class Settings { |FileUtils.S_IRGRP|FileUtils.S_IWGRP, -1, -1); writePackageListLPr(); writeAllUsersPackageRestrictionsLPr(); writeAllRuntimePermissionsLPr(); return; } catch(XmlPullParserException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } catch(java.io.IOException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } // Clean up partially written files if (mSettingsFilename.exists()) { if (!mSettingsFilename.delete()) { Slog.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename); } } //Debug.stopMethodTracing(); } void writePackageListLPr() { writePackageListLPr(-1); } void writePackageListLPr(int creatingUserId) { // Only derive GIDs for active users (not dying) final List<UserInfo> users = UserManagerService.getInstance().getUsers(true); int[] userIds = new int[users.size()]; for (int i = 0; i < userIds.length; i++) { userIds[i] = users.get(i).id; } if (creatingUserId != -1) { userIds = ArrayUtils.appendInt(userIds, creatingUserId); } // Write package list file now, use a JournaledFile. File tempFile = new File(mPackageListFilename.getAbsolutePath() + ".tmp"); JournaledFile journal = new JournaledFile(mPackageListFilename, tempFile); final File writeTarget = journal.chooseForWrite(); FileOutputStream fstr = null; BufferedOutputStream str = null; try { fstr = new FileOutputStream(writeTarget); str = new BufferedOutputStream(fstr); try { FileUtils.setPermissions(fstr.getFD(), 0640, SYSTEM_UID, PACKAGE_INFO_GID); StringBuilder sb = new StringBuilder(); Loading @@ -2042,7 +2081,7 @@ final class Settings { final ApplicationInfo ai = pkg.pkg.applicationInfo; final String dataPath = ai.dataDir; final boolean isDebug = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; final int[] gids = pkg.getPermissionsState().computeGids(); final int[] gids = pkg.getPermissionsState().computeGids(userIds); // Avoid any application that has a space in its path. if (dataPath.indexOf(" ") >= 0) Loading Loading @@ -2096,27 +2135,6 @@ final class Settings { IoUtils.closeQuietly(str); journal.rollback(); } writeAllUsersPackageRestrictionsLPr(); writeAllRuntimePermissionsLPr(); return; } catch(XmlPullParserException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } catch(java.io.IOException e) { Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e); } // Clean up partially written files if (mSettingsFilename.exists()) { if (!mSettingsFilename.delete()) { Slog.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename); } } //Debug.stopMethodTracing(); } void writeDisabledSysPackageLPr(XmlSerializer serializer, final PackageSetting pkg) Loading Loading @@ -3491,6 +3509,7 @@ final class Settings { } readDefaultPreferredAppsLPw(service, userHandle); writePackageRestrictionsLPr(userHandle); writePackageListLPr(userHandle); } void removeUserLPw(int userId) { Loading @@ -3506,6 +3525,8 @@ final class Settings { removeCrossProfileIntentFiltersLPw(userId); mRuntimePermissionsPersistence.onUserRemoved(userId); writePackageListLPr(); } void removeCrossProfileIntentFiltersLPw(int userId) { Loading