Merge "Fix issue #2569139: Cannot login to last.fm after upgrade from Donut to FRF01B" into froyo
This commit is contained in:
committed by
Android (Google) Code Review
commit
48bce4515d
@@ -954,7 +954,20 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
+ ((SystemClock.uptimeMillis()-startTime)/1000f)
|
+ ((SystemClock.uptimeMillis()-startTime)/1000f)
|
||||||
+ " seconds");
|
+ " seconds");
|
||||||
|
|
||||||
updatePermissionsLP(null, null, true, false);
|
// If the platform SDK has changed since the last time we booted,
|
||||||
|
// we need to re-grant app permission to catch any new ones that
|
||||||
|
// appear. This is really a hack, and means that apps can in some
|
||||||
|
// cases get permissions that the user didn't initially explicitly
|
||||||
|
// allow... it would be nice to have some better way to handle
|
||||||
|
// this situation.
|
||||||
|
final boolean regrantPermissions = mSettings.mInternalSdkPlatform
|
||||||
|
!= mSdkVersion;
|
||||||
|
if (regrantPermissions) Slog.i(TAG, "Platform changed from "
|
||||||
|
+ mSettings.mInternalSdkPlatform + " to " + mSdkVersion
|
||||||
|
+ "; regranting permissions for internal storage");
|
||||||
|
mSettings.mInternalSdkPlatform = mSdkVersion;
|
||||||
|
|
||||||
|
updatePermissionsLP(null, null, true, regrantPermissions);
|
||||||
|
|
||||||
mSettings.writeLP();
|
mSettings.writeLP();
|
||||||
|
|
||||||
@@ -7707,6 +7720,12 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
final HashMap<String, PackageSetting> mDisabledSysPackages =
|
final HashMap<String, PackageSetting> mDisabledSysPackages =
|
||||||
new HashMap<String, PackageSetting>();
|
new HashMap<String, PackageSetting>();
|
||||||
|
|
||||||
|
// These are the last platform API version we were using for
|
||||||
|
// the apps installed on internal and external storage. It is
|
||||||
|
// used to grant newer permissions one time during a system upgrade.
|
||||||
|
int mInternalSdkPlatform;
|
||||||
|
int mExternalSdkPlatform;
|
||||||
|
|
||||||
// The user's preferred activities associated with particular intent
|
// The user's preferred activities associated with particular intent
|
||||||
// filters.
|
// filters.
|
||||||
private final IntentResolver<PreferredActivity, PreferredActivity> mPreferredActivities =
|
private final IntentResolver<PreferredActivity, PreferredActivity> mPreferredActivities =
|
||||||
@@ -8291,6 +8310,11 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
|
|
||||||
serializer.startTag(null, "packages");
|
serializer.startTag(null, "packages");
|
||||||
|
|
||||||
|
serializer.startTag(null, "last-platform-version");
|
||||||
|
serializer.attribute(null, "internal", Integer.toString(mInternalSdkPlatform));
|
||||||
|
serializer.attribute(null, "external", Integer.toString(mExternalSdkPlatform));
|
||||||
|
serializer.endTag(null, "last-platform-version");
|
||||||
|
|
||||||
serializer.startTag(null, "permission-trees");
|
serializer.startTag(null, "permission-trees");
|
||||||
for (BasePermission bp : mPermissionTrees.values()) {
|
for (BasePermission bp : mPermissionTrees.values()) {
|
||||||
writePermission(serializer, bp);
|
writePermission(serializer, bp);
|
||||||
@@ -8684,6 +8708,19 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
if (nname != null && oname != null) {
|
if (nname != null && oname != null) {
|
||||||
mRenamedPackages.put(nname, oname);
|
mRenamedPackages.put(nname, oname);
|
||||||
}
|
}
|
||||||
|
} else if (tagName.equals("last-platform-version")) {
|
||||||
|
mInternalSdkPlatform = mExternalSdkPlatform = 0;
|
||||||
|
try {
|
||||||
|
String internal = parser.getAttributeValue(null, "internal");
|
||||||
|
if (internal != null) {
|
||||||
|
mInternalSdkPlatform = Integer.parseInt(internal);
|
||||||
|
}
|
||||||
|
String external = parser.getAttributeValue(null, "external");
|
||||||
|
if (external != null) {
|
||||||
|
mInternalSdkPlatform = Integer.parseInt(external);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Slog.w(TAG, "Unknown element under <packages>: "
|
Slog.w(TAG, "Unknown element under <packages>: "
|
||||||
+ parser.getName());
|
+ parser.getName());
|
||||||
@@ -9553,9 +9590,22 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
|
// If the platform SDK has changed since the last time we booted,
|
||||||
|
// we need to re-grant app permission to catch any new ones that
|
||||||
|
// appear. This is really a hack, and means that apps can in some
|
||||||
|
// cases get permissions that the user didn't initially explicitly
|
||||||
|
// allow... it would be nice to have some better way to handle
|
||||||
|
// this situation.
|
||||||
|
final boolean regrantPermissions = mSettings.mExternalSdkPlatform
|
||||||
|
!= mSdkVersion;
|
||||||
|
if (regrantPermissions) Slog.i(TAG, "Platform changed from "
|
||||||
|
+ mSettings.mExternalSdkPlatform + " to " + mSdkVersion
|
||||||
|
+ "; regranting permissions for external storage");
|
||||||
|
mSettings.mExternalSdkPlatform = mSdkVersion;
|
||||||
|
|
||||||
// Make sure group IDs have been assigned, and any permission
|
// Make sure group IDs have been assigned, and any permission
|
||||||
// changes in other apps are accounted for
|
// changes in other apps are accounted for
|
||||||
updatePermissionsLP(null, null, true, false);
|
updatePermissionsLP(null, null, true, regrantPermissions);
|
||||||
// Persist settings
|
// Persist settings
|
||||||
mSettings.writeLP();
|
mSettings.writeLP();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user