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

Commit 146701ca authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Move SharedPreferences code to its own class.

Bug: 251502424
Test: Code compiled correctly.
Change-Id: Iea0d6ab2999504117546ee0f7adc0c7b8b45c065
parent 698239e1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@ import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;

import com.android.launcher3.BaseActivity;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.ArrowTipView;
import com.android.quickstep.util.AssistContentRequester;
import com.android.quickstep.util.RecentsOrientedState;
@@ -124,7 +124,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
                AssistContentRequester assistContentRequester) {
            super(taskThumbnailView);
            mFactoryContentRequester = assistContentRequester;
            mSharedPreferences = Utilities.getPrefs(mApplicationContext);
            mSharedPreferences = LauncherPrefs.getPrefs(mApplicationContext);
        }

        /**
@@ -151,7 +151,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory {
            boolean isAllowedByPolicy = mThumbnailView.isRealSnapshot() && !isManagedProfileTask;
            getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task));
            mTaskPackageName = task.key.getPackageName();
            mSharedPreferences = Utilities.getPrefs(mApplicationContext);
            mSharedPreferences = LauncherPrefs.getPrefs(mApplicationContext);
            checkSettings();

            if (!mAssistStructurePermitted || !mAssistScreenshotPermitted
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.os.UserHandle;
import androidx.annotation.NonNull;

import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.QuickstepModelDelegate.PredictorState;
import com.android.launcher3.model.data.AppInfo;
@@ -59,7 +59,7 @@ public class PredictionUpdateTask extends BaseModelUpdateTask {
        Context context = app.getContext();

        // TODO: remove this
        Utilities.getDevicePrefs(context).edit()
        LauncherPrefs.getDevicePrefs(context).edit()
                .putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply();

        Set<UserHandle> usersForChangedShortcuts =
+1 −1
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@ package com.android.launcher3.model;
import static android.text.format.DateUtils.DAY_IN_MILLIS;
import static android.text.format.DateUtils.formatElapsedTime;

import static com.android.launcher3.LauncherPrefs.getDevicePrefs;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
import static com.android.launcher3.Utilities.getDevicePrefs;
import static com.android.launcher3.hybridhotseat.HotseatPredictionModel.convertDataModelToAppTargetBundle;
import static com.android.launcher3.model.PredictionHelper.getAppTargetFromItemInfo;
import static com.android.launcher3.model.PredictionHelper.wrapAppTargetWithItemLocation;
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@ import android.view.View;
import android.view.ViewOutlineProvider;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.util.DisplayController;
@@ -81,7 +81,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
    public StashedHandleViewController(TaskbarActivityContext activity,
            StashedHandleView stashedHandleView) {
        mActivity = activity;
        mPrefs = Utilities.getPrefs(mActivity);
        mPrefs = LauncherPrefs.getPrefs(mActivity);
        mStashedHandleView = stashedHandleView;
        mTaskbarStashedHandleAlpha = new MultiValueAlpha(mStashedHandleView, NUM_ALPHA_CHANNELS);
        mTaskbarStashedHandleAlpha.setUpdateVisibility(true);
+2 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.launcher3.Alarm;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorListeners;
@@ -187,7 +188,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    public TaskbarStashController(TaskbarActivityContext activity) {
        mActivity = activity;
        mPrefs = Utilities.getPrefs(mActivity);
        mPrefs = LauncherPrefs.getPrefs(mActivity);
        mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
        if (isPhoneMode()) {
            // DeviceProfile's taskbar vars aren't initialized w/ the flag off
Loading