Merge "Don't set the time zone under the caller's identity" into jb-mr1-dev

This commit is contained in:
Christopher Tate
2012-08-31 14:47:34 -07:00
committed by Android (Google) Code Review

View File

@ -243,6 +243,8 @@ class AlarmManagerService extends IAlarmManager.Stub {
"android.permission.SET_TIME_ZONE",
"setTimeZone");
long oldId = Binder.clearCallingIdentity();
try {
if (TextUtils.isEmpty(tz)) return;
TimeZone zone = TimeZone.getTimeZone(tz);
// Prevent reentrant calls from stepping on each other when writing
@ -251,7 +253,9 @@ class AlarmManagerService extends IAlarmManager.Stub {
synchronized (this) {
String current = SystemProperties.get(TIMEZONE_PROPERTY);
if (current == null || !current.equals(zone.getID())) {
if (localLOGV) Slog.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
if (localLOGV) {
Slog.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
}
timeZoneWasChanged = true;
SystemProperties.set(TIMEZONE_PROPERTY, zone.getID());
}
@ -270,6 +274,9 @@ class AlarmManagerService extends IAlarmManager.Stub {
intent.putExtra("time-zone", zone.getID());
mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
}
} finally {
Binder.restoreCallingIdentity(oldId);
}
}
public void remove(PendingIntent operation) {