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

Commit df086ecb authored by Neil Fuller's avatar Neil Fuller
Browse files

Switch settings to use TimeDetector

Switch settings to use TimeZoneDetector when setting the system time
zone rather than using AlarmManager directly.

Bug: 140712361
Test: treehugger
Test: manual
Test: make -j30 RunSettingsRoboTests
Change-Id: I6042093294ba9690d4355bfe1c47d9f88a2b7ac6
parent 9c2c1b47
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -17,8 +17,9 @@
package com.android.settings.datetime.timezone;
package com.android.settings.datetime.timezone;


import android.app.Activity;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.settings.SettingsEnums;
import android.app.settings.SettingsEnums;
import android.app.timezonedetector.ManualTimeZoneSuggestion;
import android.app.timezonedetector.TimeZoneDetector;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences;
@@ -270,7 +271,10 @@ public class TimeZoneSettings extends DashboardFragment {
            editor.putString(PREF_KEY_REGION, regionId);
            editor.putString(PREF_KEY_REGION, regionId);
        }
        }
        editor.apply();
        editor.apply();
        getActivity().getSystemService(AlarmManager.class).setTimeZone(tzId);
        ManualTimeZoneSuggestion manualTimeZoneSuggestion =
                TimeZoneDetector.createManualTimeZoneSuggestion(tzId, "Settings: Set time zone");
        TimeZoneDetector timeZoneDetector = getActivity().getSystemService(TimeZoneDetector.class);
        timeZoneDetector.suggestManualTimeZone(manualTimeZoneSuggestion);
    }
    }


    @Override
    @Override