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

Commit 8fe9e371 authored by Neil Fuller's avatar Neil Fuller
Browse files

Remove broadcast of NETWORK_SET_TIMEZONE intent

android.intent.action.NETWORK_SET_TIMEZONE is not used by anything in
the platform so it can be removed. It was previously broadcast when
telephony made a time zone change, presumably as a way to coordinate
time zone detection logic if there were other, lower-priority detection
mechanisms on the device.

All the APK usages appear to be only manifest entries for
<protected-broadcast> in apps that don't send the intent themselves,
which doesn't make a lot of sense.

Note: There is a separate commit to remove the broadcast from the system
server time zone detection logic.

Bug: 140712361
Test: treehugger
Change-Id: I5a84580620dc74c1ab1f73a56379c2256f13ef0e
parent 18ec6884
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
            // Set state as needed.
            if (zoneId != null) {
                if (mTimeServiceHelper.isTimeZoneDetectionEnabled()) {
                    setAndBroadcastNetworkSetTimeZone(zoneId, logMsg);
                    setTimeZone(zoneId, logMsg);
                } else {
                    if (DBG) {
                        logMsg += " [Not setting device time zone]";
@@ -501,7 +501,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
        }
    }

    private void setAndBroadcastNetworkSetTimeZone(String zoneId, String logMessage) {
    private void setTimeZone(String zoneId, String logMessage) {
        logMessage += " [Setting device time zone to zoneId=" + zoneId + "]";
        if (DBG) {
            Rlog.d(LOG_TAG, logMessage);
@@ -528,7 +528,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
        String logMsg = "handleAutoTimeZoneEnabled: "
                + " mSavedTimeZoneId=" + mSavedTimeZoneId;
        if (mSavedTimeZoneId != null) {
            setAndBroadcastNetworkSetTimeZone(mSavedTimeZoneId, logMsg);
            setTimeZone(mSavedTimeZoneId, logMsg);
        } else {
            if (DBG) {
                logMsg += " [Not setting device time zone]";
@@ -587,7 +587,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine {

            String zoneId = lookupResult.zoneId;
            if (mTimeServiceHelper.isTimeZoneDetectionEnabled()) {
                setAndBroadcastNetworkSetTimeZone(zoneId, logMsg);
                setTimeZone(zoneId, logMsg);
            } else {
                if (DBG) {
                    logMsg += " [Not setting device time zone]";
+0 −6
Original line number Diff line number Diff line
@@ -21,11 +21,9 @@ import android.app.timedetector.PhoneTimeSuggestion;
import android.app.timedetector.TimeDetector;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;

/**
@@ -95,10 +93,6 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper {
    public void setDeviceTimeZone(String zoneId) {
        AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
        alarmManager.setTimeZone(zoneId);
        Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
        intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
        intent.putExtra("time-zone", zoneId);
        mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
    }

    @Override