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

Commit 8f0ec566 authored by Yvonne Wong's avatar Yvonne Wong Committed by Gerrit Code Review
Browse files

Switch packages and services in frameworks not on the bootclasspath to use CMSettings

Issue-Id: CYNGNOS-831
Change-Id: Ib952b31ffc1606d6c6177d301dfbe47918315025
parent ac134476
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2190,8 +2190,10 @@ public final class Settings {
        /**
         * Quick Settings Quick Pulldown
         * 0 = off, 1 = right, 2 = left
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.System#QS_QUICK_PULLDOWN} instead
         * @hide
         */
        @Deprecated
        public static final String QS_QUICK_PULLDOWN = "qs_quick_pulldown";

        /**
@@ -5976,8 +5978,10 @@ public final class Settings {
         *
         * ex: mods_icons|mods_overlays|mods_homescreen
         *
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#DEFAULT_THEME_COMPONENTS}
         * @hide
         */
        @Deprecated
        public static final String DEFAULT_THEME_COMPONENTS = "default_theme_components";

        /**
@@ -6006,8 +6010,10 @@ public final class Settings {

        /**
         * Global stats collection
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#STATS_COLLECTION}
         * @hide
         */
        @Deprecated
        public static final String STATS_COLLECTION = "stats_collection";

        /**
@@ -6032,8 +6038,10 @@ public final class Settings {

        /**
         * Whether to show the brightness slider in quick settings panel.
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#QS_SHOW_BRIGHTNESS_SLIDER}
         * @hide
         */
        @Deprecated
        public static final String QS_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider";

        /**
@@ -6045,8 +6053,10 @@ public final class Settings {
        /**
         * Use "main" tiles on the first row of the quick settings panel
         * 0 = no, 1 = yes
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#QS_USE_MAIN_TILES}
         * @hide
         */
        @Deprecated
        public static final String QS_USE_MAIN_TILES = "sysui_qs_main_tiles";

        /**
@@ -6057,8 +6067,10 @@ public final class Settings {

        /**
         * Custom navring actions
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#NAVIGATION_RING_TARGETS}
         * @hide
         */
        @Deprecated
        public static final String[] NAVIGATION_RING_TARGETS = new String[] {
                "navigation_ring_targets_0",
                "navigation_ring_targets_1",
@@ -6077,8 +6089,10 @@ public final class Settings {
        /**
         * Whether to enable "advanced mode" for the current user.
         * Boolean setting. 0 = no, 1 = yes.
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#ADVANCED_MODE}
         * @hide
         */
        @Deprecated
        public static final String ADVANCED_MODE = "advanced_mode";

        /**
@@ -6096,23 +6110,29 @@ public final class Settings {
        /**
         * The keyboard brightness to be used while the screen is on.
         * Valid value range is between 0 and {@link PowerManager#getMaximumKeyboardBrightness()}
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#KEYBOARD_BRIGHTNESS}
         * @hide
         */
        @Deprecated
        public static final String KEYBOARD_BRIGHTNESS = "keyboard_brightness";

        /**
         * The button brightness to be used while the screen is on or after a button press,
         * depending on the value of {@link BUTTON_BACKLIGHT_TIMEOUT}.
         * Valid value range is between 0 and {@link PowerManager#getMaximumButtonBrightness()}
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#KEYBOARD_BRIGHTNESS}
         * @hide
         */
        @Deprecated
        public static final String BUTTON_BRIGHTNESS = "button_brightness";

        /**
         * The time in ms to keep the button backlight on after pressing a button.
         * A value of 0 will keep the buttons on for as long as the screen is on.
         * @deprecated Use {@link cyanogenmod.providers.CMSettings.Secure#BUTTON_BACKLIGHT_TIMEOUT}
         * @hide
         */
        @Deprecated
        public static final String BUTTON_BACKLIGHT_TIMEOUT = "button_backlight_timeout";

        /**
+4 −3
Original line number Diff line number Diff line
@@ -21,14 +21,15 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.provider.Settings;

import cyanogenmod.providers.CMSettings;

public class StatsUtils {
    private static final String STATS_PACKAGE = "com.cyngn.stats";

    public static boolean isStatsCollectionEnabled(Context context) {
        return Settings.Secure.getInt(context.getContentResolver(),
                Settings.Secure.STATS_COLLECTION, 1) != 0;
        return CMSettings.Secure.getInt(context.getContentResolver(),
                CMSettings.Secure.STATS_COLLECTION, 1) != 0;
    }

    public static boolean isStatsPackageInstalled(Context context) {
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.GET_APP_OPS_STATS" />

    <!-- CM Settings -->
    <uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS"/>
    <uses-permission android:name="cyanogenmod.permission.WRITE_SECURE_SETTINGS"/>

    <!-- Networking and telephony -->
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+5 −3
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.StatusBarPanel;
import com.android.systemui.statusbar.phone.PhoneStatusBar;

import cyanogenmod.providers.CMSettings;

import java.util.ArrayList;
import java.util.List;

@@ -434,8 +436,8 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
    public void shortcutPicked(String uri) {
        if (uri != null) {
            int index = mTargetViews.indexOf(mSelectedView);
            Settings.Secure.putStringForUser(mContext.getContentResolver(),
                    Settings.Secure.NAVIGATION_RING_TARGETS[index], uri, UserHandle.USER_CURRENT);
            CMSettings.Secure.putStringForUser(mContext.getContentResolver(),
                    CMSettings.Secure.NAVIGATION_RING_TARGETS[index], uri, UserHandle.USER_CURRENT);
        }
    }

@@ -451,7 +453,7 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
            ContentResolver resolver = mContext.getContentResolver();
            for (int i = 0; i < NavigationRingHelpers.MAX_ACTIONS; i++) {
                resolver.registerContentObserver(
                        Settings.Secure.getUriFor(Settings.Secure.NAVIGATION_RING_TARGETS[i]),
                        CMSettings.Secure.getUriFor(CMSettings.Secure.NAVIGATION_RING_TARGETS[i]),
                        false, this, UserHandle.USER_ALL);
            }
        }
+7 −5
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.provider.Settings;
import android.text.TextUtils;
import com.android.systemui.R;

import cyanogenmod.providers.CMSettings;

import java.net.URISyntaxException;

import static com.android.internal.util.cm.NavigationRingConstants.*;
@@ -47,8 +49,8 @@ public class NavigationRingHelpers {
        boolean isDefault = true;

        for (int i = 0; i < MAX_ACTIONS; i++) {
            result[i] = Settings.Secure.getStringForUser(cr,
                    Settings.Secure.NAVIGATION_RING_TARGETS[i], UserHandle.USER_CURRENT);
            result[i] = CMSettings.Secure.getStringForUser(cr,
                    CMSettings.Secure.NAVIGATION_RING_TARGETS[i], UserHandle.USER_CURRENT);
            if (result[i] != null) {
                isDefault = false;
            }
@@ -79,11 +81,11 @@ public class NavigationRingHelpers {

    public static void resetActionsToDefaults(Context context) {
        final ContentResolver cr = context.getContentResolver();
        Settings.Secure.putStringForUser(cr, Settings.Secure.NAVIGATION_RING_TARGETS[0], null,
        CMSettings.Secure.putStringForUser(cr, CMSettings.Secure.NAVIGATION_RING_TARGETS[0], null,
                UserHandle.USER_CURRENT);
        Settings.Secure.putStringForUser(cr, Settings.Secure.NAVIGATION_RING_TARGETS[1],
        CMSettings.Secure.putStringForUser(cr, CMSettings.Secure.NAVIGATION_RING_TARGETS[1],
                ACTION_ASSIST, UserHandle.USER_CURRENT);
        Settings.Secure.putStringForUser(cr, Settings.Secure.NAVIGATION_RING_TARGETS[2], null,
        CMSettings.Secure.putStringForUser(cr, CMSettings.Secure.NAVIGATION_RING_TARGETS[2], null,
                UserHandle.USER_CURRENT);
    }

Loading