Merge "[NotificationManagerService]: Fixes the thread-safe issue." am: d530d1bf18 am: f69a73793d
am: d0e81464bd
Change-Id: I8a2f552e3fa500f14e1912acbbbade3ea510715f
This commit is contained in:
@@ -2078,12 +2078,14 @@ public class NotificationManagerService extends SystemService {
|
|||||||
Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
|
Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
synchronized(mPolicyFile) {
|
||||||
try {
|
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
writePolicyXml(baos, true /*forBackup*/);
|
try {
|
||||||
return baos.toByteArray();
|
writePolicyXml(baos, true /*forBackup*/);
|
||||||
} catch (IOException e) {
|
return baos.toByteArray();
|
||||||
Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
|
} catch (IOException e) {
|
||||||
|
Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -2101,12 +2103,14 @@ public class NotificationManagerService extends SystemService {
|
|||||||
Slog.w(TAG, "applyRestore: cannot restore policy for user " + user);
|
Slog.w(TAG, "applyRestore: cannot restore policy for user " + user);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
|
synchronized(mPolicyFile) {
|
||||||
try {
|
final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
|
||||||
readPolicyXml(bais, true /*forRestore*/);
|
try {
|
||||||
savePolicyFile();
|
readPolicyXml(bais, true /*forRestore*/);
|
||||||
} catch (NumberFormatException | XmlPullParserException | IOException e) {
|
savePolicyFile();
|
||||||
Slog.w(TAG, "applyRestore: error reading payload", e);
|
} catch (NumberFormatException | XmlPullParserException | IOException e) {
|
||||||
|
Slog.w(TAG, "applyRestore: error reading payload", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user