Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89779822 authored by Christopher Tate's avatar Christopher Tate
Browse files

Don't set the time zone under the caller's identity

...otherwise you crash trying to send a broadcast to all users.

Change-Id: If627eeb3eadb1052242c986fe24482d87c8fc093
parent 8c890f8a
Loading
Loading
Loading
Loading
+31 −24
Original line number Diff line number Diff line
@@ -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) {