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

Commit 0cbc389d authored by Colin Marsch's avatar Colin Marsch Committed by Michael Bestas
Browse files

AOSP/DeskClock - Fix deprecated calls: ScreensaverSettings,SettingsActivity

Test: manual, tested the DeskClock UI. As well tests were ran as follows

$ source build/envsetup.sh
$ lunch aosp_sargo-userdebug
$ make DeskClock
$ adb install out/target/product/sargo/product/app/DeskClock/DeskClock.apk
$ atest DeskClockTests
$ make DeskClockJava
$ adb install out/target/product/sargo/product/app/DeskClockJava/DeskClockJava.apk
$ atest DeskClockTests

BUG: 157255731
Change-Id: Iecbbe5b390e8121bd6131431b2fd2f2c56467428
parent c6da36af
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ package com.android.deskclock.settings;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;

import com.android.deskclock.R;
import com.android.deskclock.Utils;
@@ -55,7 +55,7 @@ public final class ScreensaverSettingsActivity extends AppCompatActivity {
    }


    public static class PrefsFragment extends PreferenceFragment
    public static class PrefsFragment extends PreferenceFragmentCompat
            implements Preference.OnPreferenceChangeListener {

        @Override
@@ -66,6 +66,10 @@ public final class ScreensaverSettingsActivity extends AppCompatActivity {
            if (Utils.isNOrLater()) {
                getPreferenceManager().setStorageDeviceProtected();
            }
        }

        @Override
        public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
            addPreferencesFromResource(R.xml.screensaver_settings);
        }

+3 −2
Original line number Diff line number Diff line
@@ -235,7 +235,8 @@ public final class SettingsActivity extends BaseActivity {

        private void showDialog(PreferenceDialogFragmentCompat fragment) {
            // Don't show dialog if one is already shown.
            if (getFragmentManager().findFragmentByTag(PREFERENCE_DIALOG_FRAGMENT_TAG) != null) {
            if (getParentFragmentManager()
                    .findFragmentByTag(PREFERENCE_DIALOG_FRAGMENT_TAG) != null) {
                return;
            }
            // Always set the target fragment, this is required by PreferenceDialogFragment
@@ -243,7 +244,7 @@ public final class SettingsActivity extends BaseActivity {
            fragment.setTargetFragment(this, 0);
            // Don't use getChildFragmentManager(), it causes issues on older platforms when the
            // target fragment is being restored after an orientation change.
            fragment.show(getFragmentManager(), PREFERENCE_DIALOG_FRAGMENT_TAG);
            fragment.show(getParentFragmentManager(), PREFERENCE_DIALOG_FRAGMENT_TAG);
        }

        /**