Merge commit '888b702c81b21847b19c4e2845686ed35cc03a0e' into eclair-mr2-plus-aosp * commit '888b702c81b21847b19c4e2845686ed35cc03a0e': Fix #2176803 - restores from userdebug to user builds not working
This commit is contained in:
@@ -1260,9 +1260,20 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
|
|
||||||
// ----- Restore handling -----
|
// ----- Restore handling -----
|
||||||
|
|
||||||
private boolean signaturesMatch(Signature[] storedSigs, Signature[] deviceSigs) {
|
private boolean signaturesMatch(Signature[] storedSigs, PackageInfo target) {
|
||||||
|
// If the target resides on the system partition, we allow it to restore
|
||||||
|
// data from the like-named package in a restore set even if the signatures
|
||||||
|
// do not match. (Unlike general applications, those flashed to the system
|
||||||
|
// partition will be signed with the device's platform certificate, so on
|
||||||
|
// different phones the same system app will have different signatures.)
|
||||||
|
if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
|
||||||
|
if (DEBUG) Log.v(TAG, "System app " + target.packageName + " - skipping sig check");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow unsigned apps, but not signed on one device and unsigned on the other
|
// Allow unsigned apps, but not signed on one device and unsigned on the other
|
||||||
// !!! TODO: is this the right policy?
|
// !!! TODO: is this the right policy?
|
||||||
|
Signature[] deviceSigs = target.signatures;
|
||||||
if (DEBUG) Log.v(TAG, "signaturesMatch(): stored=" + storedSigs
|
if (DEBUG) Log.v(TAG, "signaturesMatch(): stored=" + storedSigs
|
||||||
+ " device=" + deviceSigs);
|
+ " device=" + deviceSigs);
|
||||||
if ((storedSigs == null || storedSigs.length == 0)
|
if ((storedSigs == null || storedSigs.length == 0)
|
||||||
@@ -1465,7 +1476,7 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!signaturesMatch(metaInfo.signatures, packageInfo.signatures)) {
|
if (!signaturesMatch(metaInfo.signatures, packageInfo)) {
|
||||||
Log.w(TAG, "Signature mismatch restoring " + packageName);
|
Log.w(TAG, "Signature mismatch restoring " + packageName);
|
||||||
EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
|
EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
|
||||||
"Signature mismatch");
|
"Signature mismatch");
|
||||||
|
|||||||
Reference in New Issue
Block a user