Loading quickstep/src/com/android/launcher3/uioverrides/plugins/PluginEnablerImpl.java +19 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,11 @@ import android.content.SharedPreferences; import com.android.launcher3.Utilities; import com.android.systemui.shared.plugins.PluginEnabler; public class PluginEnablerImpl implements PluginEnabler { import androidx.preference.PreferenceDataStore; public class PluginEnablerImpl extends PreferenceDataStore implements PluginEnabler { private static final String PREFIX_PLUGIN_ENABLED = "PLUGIN_ENABLED_"; final private SharedPreferences mSharedPrefs; Loading @@ -31,15 +35,25 @@ public class PluginEnablerImpl implements PluginEnabler { @Override public void setEnabled(ComponentName component, boolean enabled) { mSharedPrefs.edit().putBoolean(toPrefString(component), enabled).apply(); putBoolean(pluginEnabledKey(component), enabled); } @Override public boolean isEnabled(ComponentName component) { return mSharedPrefs.getBoolean(toPrefString(component), true); return getBoolean(pluginEnabledKey(component), true); } @Override public void putBoolean(String key, boolean value) { mSharedPrefs.edit().putBoolean(key, value).apply(); } @Override public boolean getBoolean(String key, boolean defValue) { return mSharedPrefs.getBoolean(key, defValue); } private String toPrefString(ComponentName component) { return "PLUGIN_ENABLED_" + component.flattenToString(); static String pluginEnabledKey(ComponentName cn) { return PREFIX_PLUGIN_ENABLED + cn.flattenToString(); } } quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ import android.content.Context; import android.os.Looper; import com.android.launcher3.LauncherModel; import com.android.systemui.shared.plugins.PluginEnabler; import com.android.systemui.shared.plugins.PluginInitializer; public class PluginInitializerImpl implements PluginInitializer { Loading @@ -37,7 +36,7 @@ public class PluginInitializerImpl implements PluginInitializer { } @Override public PluginEnabler getPluginEnabler(Context context) { public PluginEnablerImpl getPluginEnabler(Context context) { return new PluginEnablerImpl(context); } Loading quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java +26 −5 Original line number Diff line number Diff line Loading @@ -14,31 +14,37 @@ package com.android.launcher3.uioverrides.plugins; import android.content.ComponentName; import android.content.Context; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.systemui.plugins.Plugin; import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginEnabler; import com.android.systemui.shared.plugins.PluginInitializer; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.plugins.PluginManagerImpl; import com.android.systemui.shared.plugins.PluginPrefs; import java.util.Set; public class PluginManagerWrapper { public static final MainThreadInitializedObject<PluginManagerWrapper> INSTANCE = new MainThreadInitializedObject<>(PluginManagerWrapper::new); public static final String PLUGIN_CHANGED = PluginManager.PLUGIN_CHANGED; private final Context mContext; private final PluginManager mPluginManager; private final PluginEnabler mPluginEnabler; private final PluginEnablerImpl mPluginEnabler; private PluginManagerWrapper(Context c) { PluginInitializer pluginInitializer = new PluginInitializerImpl(); mContext = c; PluginInitializerImpl pluginInitializer = new PluginInitializerImpl(); mPluginManager = new PluginManagerImpl(c, pluginInitializer); mPluginEnabler = pluginInitializer.getPluginEnabler(c); } PluginEnabler getPluginEnabler() { public PluginEnablerImpl getPluginEnabler() { return mPluginEnabler; } Loading @@ -54,4 +60,19 @@ public class PluginManagerWrapper { public void removePluginListener(PluginListener<? extends Plugin> listener) { mPluginManager.removePluginListener(listener); } public Set<String> getPluginActions() { return new PluginPrefs(mContext).getPluginList(); } /** * Returns the string key used to store plugin enabled/disabled setting */ public static String pluginEnabledKey(ComponentName cn) { return PluginEnablerImpl.pluginEnabledKey(cn); } public static boolean hasPlugins(Context context) { return PluginPrefs.hasPlugins(context); } } res/values/config.xml +5 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ <string name="delete_package_intent" translatable="false">#Intent;action=android.intent.action.DELETE;launchFlags=0x10800000;end</string> <!-- String representing the fragment class for settings activity.--> <string name="settings_fragment_name" translatable="false">com.android.launcher3.SettingsActivity$LauncherSettingsFragment</string> <string name="settings_fragment_name" translatable="false">com.android.launcher3.settings.SettingsActivity$LauncherSettingsFragment</string> <!-- Values for icon shape overrides. These should correspond to entries defined in icon_shape_override_paths_names --> Loading Loading @@ -105,6 +105,9 @@ <item type="id" name="view_unhighlight_background" /> <item type="id" name="view_highlighted" /> <!-- Menu id for feature flags --> <item type="id" name="menu_apply_flags" /> <!-- Popup items --> <integer name="config_popupOpenCloseDuration">150</integer> <integer name="config_popupArrowOpenCloseDuration">40</integer> Loading res/xml/flag_preferences.xmldeleted 100644 → 0 +0 −24 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="feature_flags" android:persistent="false"> </PreferenceScreen> No newline at end of file Loading
quickstep/src/com/android/launcher3/uioverrides/plugins/PluginEnablerImpl.java +19 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,11 @@ import android.content.SharedPreferences; import com.android.launcher3.Utilities; import com.android.systemui.shared.plugins.PluginEnabler; public class PluginEnablerImpl implements PluginEnabler { import androidx.preference.PreferenceDataStore; public class PluginEnablerImpl extends PreferenceDataStore implements PluginEnabler { private static final String PREFIX_PLUGIN_ENABLED = "PLUGIN_ENABLED_"; final private SharedPreferences mSharedPrefs; Loading @@ -31,15 +35,25 @@ public class PluginEnablerImpl implements PluginEnabler { @Override public void setEnabled(ComponentName component, boolean enabled) { mSharedPrefs.edit().putBoolean(toPrefString(component), enabled).apply(); putBoolean(pluginEnabledKey(component), enabled); } @Override public boolean isEnabled(ComponentName component) { return mSharedPrefs.getBoolean(toPrefString(component), true); return getBoolean(pluginEnabledKey(component), true); } @Override public void putBoolean(String key, boolean value) { mSharedPrefs.edit().putBoolean(key, value).apply(); } @Override public boolean getBoolean(String key, boolean defValue) { return mSharedPrefs.getBoolean(key, defValue); } private String toPrefString(ComponentName component) { return "PLUGIN_ENABLED_" + component.flattenToString(); static String pluginEnabledKey(ComponentName cn) { return PREFIX_PLUGIN_ENABLED + cn.flattenToString(); } }
quickstep/src/com/android/launcher3/uioverrides/plugins/PluginInitializerImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ import android.content.Context; import android.os.Looper; import com.android.launcher3.LauncherModel; import com.android.systemui.shared.plugins.PluginEnabler; import com.android.systemui.shared.plugins.PluginInitializer; public class PluginInitializerImpl implements PluginInitializer { Loading @@ -37,7 +36,7 @@ public class PluginInitializerImpl implements PluginInitializer { } @Override public PluginEnabler getPluginEnabler(Context context) { public PluginEnablerImpl getPluginEnabler(Context context) { return new PluginEnablerImpl(context); } Loading
quickstep/src/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java +26 −5 Original line number Diff line number Diff line Loading @@ -14,31 +14,37 @@ package com.android.launcher3.uioverrides.plugins; import android.content.ComponentName; import android.content.Context; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.systemui.plugins.Plugin; import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginEnabler; import com.android.systemui.shared.plugins.PluginInitializer; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.plugins.PluginManagerImpl; import com.android.systemui.shared.plugins.PluginPrefs; import java.util.Set; public class PluginManagerWrapper { public static final MainThreadInitializedObject<PluginManagerWrapper> INSTANCE = new MainThreadInitializedObject<>(PluginManagerWrapper::new); public static final String PLUGIN_CHANGED = PluginManager.PLUGIN_CHANGED; private final Context mContext; private final PluginManager mPluginManager; private final PluginEnabler mPluginEnabler; private final PluginEnablerImpl mPluginEnabler; private PluginManagerWrapper(Context c) { PluginInitializer pluginInitializer = new PluginInitializerImpl(); mContext = c; PluginInitializerImpl pluginInitializer = new PluginInitializerImpl(); mPluginManager = new PluginManagerImpl(c, pluginInitializer); mPluginEnabler = pluginInitializer.getPluginEnabler(c); } PluginEnabler getPluginEnabler() { public PluginEnablerImpl getPluginEnabler() { return mPluginEnabler; } Loading @@ -54,4 +60,19 @@ public class PluginManagerWrapper { public void removePluginListener(PluginListener<? extends Plugin> listener) { mPluginManager.removePluginListener(listener); } public Set<String> getPluginActions() { return new PluginPrefs(mContext).getPluginList(); } /** * Returns the string key used to store plugin enabled/disabled setting */ public static String pluginEnabledKey(ComponentName cn) { return PluginEnablerImpl.pluginEnabledKey(cn); } public static boolean hasPlugins(Context context) { return PluginPrefs.hasPlugins(context); } }
res/values/config.xml +5 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ <string name="delete_package_intent" translatable="false">#Intent;action=android.intent.action.DELETE;launchFlags=0x10800000;end</string> <!-- String representing the fragment class for settings activity.--> <string name="settings_fragment_name" translatable="false">com.android.launcher3.SettingsActivity$LauncherSettingsFragment</string> <string name="settings_fragment_name" translatable="false">com.android.launcher3.settings.SettingsActivity$LauncherSettingsFragment</string> <!-- Values for icon shape overrides. These should correspond to entries defined in icon_shape_override_paths_names --> Loading Loading @@ -105,6 +105,9 @@ <item type="id" name="view_unhighlight_background" /> <item type="id" name="view_highlighted" /> <!-- Menu id for feature flags --> <item type="id" name="menu_apply_flags" /> <!-- Popup items --> <integer name="config_popupOpenCloseDuration">150</integer> <integer name="config_popupArrowOpenCloseDuration">40</integer> Loading
res/xml/flag_preferences.xmldeleted 100644 → 0 +0 −24 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="feature_flags" android:persistent="false"> </PreferenceScreen> No newline at end of file