summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest-common.xml4
-rw-r--r--res/xml/launcher_preferences.xml6
-rw-r--r--src/com/android/launcher3/Utilities.java13
-rw-r--r--src/com/android/launcher3/config/BaseFlags.java5
-rw-r--r--src/com/android/launcher3/settings/SettingsActivity.java37
-rw-r--r--src/com/android/launcher3/util/PackageManagerHelper.java5
-rw-r--r--src/com/android/launcher3/views/OptionsPopupView.java16
7 files changed, 20 insertions, 66 deletions
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 8db875be9..32b55697c 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -155,13 +155,13 @@
<!--
The content provider for exposing various launcher grid options.
+ TODO: Enable when all apps columns are correct
TODO: Add proper permissions
- -->
<provider
android:name="com.android.launcher3.graphics.GridOptionsProvider"
android:authorities="${packageName}.grid_control"
- android:enabled="false"
android:exported="true" />
+ -->
<!--
The settings activity. To extend point settings_fragment_name to appropriate fragment class
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index f4165c3b2..9f9aacb33 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -50,12 +50,6 @@
android:summary="@string/pref_show_google_now_summary"
android:title="@string/title_show_google_app" />
- <SwitchPreference
- android:key="pref_grid_options"
- android:title="Enable grid options"
- android:defaultValue="false"
- android:persistent="true" />
-
<androidx.preference.PreferenceScreen
android:key="pref_developer_options"
android:persistent="false"
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 9c27f4892..5eadb41ca 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -53,7 +53,6 @@ import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.TransactionTooLargeException;
-import android.provider.Settings;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@@ -77,7 +76,6 @@ import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.IntArray;
-import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.views.Transposable;
import com.android.launcher3.widget.PendingAddShortcutInfo;
@@ -137,11 +135,6 @@ public final class Utilities {
*/
public static final boolean IS_DEBUG_DEVICE = false;
- public static boolean isDevelopersOptionsEnabled(Context context) {
- return Settings.Global.getInt(context.getApplicationContext().getContentResolver(),
- Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
- }
-
// An intent extra to indicate the horizontal scroll of the wallpaper.
public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";
@@ -169,12 +162,6 @@ public final class Utilities {
return Log.isLoggable(propertyName, Log.VERBOSE);
}
- public static boolean existsStyleWallpapers(Context context) {
- ResolveInfo ri = context.getPackageManager().resolveActivity(
- PackageManagerHelper.getStyleWallpapersIntent(context), 0);
- return ri != null;
- }
-
/**
* Given a coordinate relative to the descendant, find the coordinate in a parent view's
* coordinates.
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index 637b172ba..8dc3df214 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -20,6 +20,7 @@ import static androidx.core.util.Preconditions.checkNotNull;
import android.content.Context;
import android.content.SharedPreferences;
+import android.provider.Settings;
import androidx.annotation.GuardedBy;
import androidx.annotation.Keep;
@@ -52,7 +53,9 @@ public abstract class BaseFlags {
}
public static boolean showFlagTogglerUi(Context context) {
- return Utilities.IS_DEBUG_DEVICE && Utilities.isDevelopersOptionsEnabled(context);
+ return Utilities.IS_DEBUG_DEVICE &&
+ Settings.Global.getInt(context.getApplicationContext().getContentResolver(),
+ Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
public static final boolean IS_DOGFOOD_BUILD = false;
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index 6dafd7d37..7c38cacdc 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -25,10 +25,6 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.DialogFragment;
import android.app.Fragment;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
@@ -37,7 +33,6 @@ import com.android.launcher3.LauncherFiles;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.graphics.GridOptionsProvider;
import com.android.launcher3.lineage.LineageLauncherCallbacks;
import com.android.launcher3.lineage.LineageUtils;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
@@ -55,8 +50,7 @@ import androidx.recyclerview.widget.RecyclerView;
* Settings activity for Launcher. Currently implements the following setting: Allow rotation
*/
public class SettingsActivity extends Activity
- implements OnPreferenceStartFragmentCallback, OnPreferenceStartScreenCallback,
- SharedPreferences.OnSharedPreferenceChangeListener{
+ implements OnPreferenceStartFragmentCallback, OnPreferenceStartScreenCallback {
private static final String DEVELOPER_OPTIONS_KEY = "pref_developer_options";
private static final String FLAGS_PREFERENCE_KEY = "flag_toggler";
@@ -70,8 +64,6 @@ public class SettingsActivity extends Activity
private static final int DELAY_HIGHLIGHT_DURATION_MILLIS = 600;
public static final String SAVE_HIGHLIGHTED_KEY = "android:preference_highlighted";
- public static final String GRID_OPTIONS_PREFERENCE_KEY = "pref_grid_options";
-
public static final String KEY_MINUS_ONE = "pref_enable_minus_one";
@Override
@@ -92,28 +84,6 @@ public class SettingsActivity extends Activity
.replace(android.R.id.content, f)
.commit();
}
- Utilities.getPrefs(getApplicationContext()).registerOnSharedPreferenceChangeListener(this);
- }
- @Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (GRID_OPTIONS_PREFERENCE_KEY.equals(key)) {
-
- final ComponentName cn = new ComponentName(getApplicationContext(),
- GridOptionsProvider.class);
- Context c = getApplicationContext();
- int oldValue = c.getPackageManager().getComponentEnabledSetting(cn);
- int newValue;
- if (Utilities.getPrefs(c).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)) {
- newValue = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
- } else {
- newValue = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
- }
-
- if (oldValue != newValue) {
- c.getPackageManager().setComponentEnabledSetting(cn, newValue,
- PackageManager.DONT_KILL_APP);
- }
- }
}
private boolean startFragment(String fragment, Bundle args, String key) {
@@ -240,11 +210,6 @@ public class SettingsActivity extends Activity
case KEY_MINUS_ONE:
return LineageUtils.hasPackageInstalled(getActivity(),
LineageLauncherCallbacks.SEARCH_PACKAGE);
-
- case GRID_OPTIONS_PREFERENCE_KEY:
- return Utilities.isDevelopersOptionsEnabled(getContext()) &&
- Utilities.IS_DEBUG_DEVICE &&
- Utilities.existsStyleWallpapers(getContext());
}
return true;
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 7d3a94162..7439ac154 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -172,11 +172,6 @@ public class PackageManagerHelper {
}
}
- public static Intent getStyleWallpapersIntent(Context context) {
- return new Intent(Intent.ACTION_SET_WALLPAPER).setComponent(
- new ComponentName(context.getString(R.string.wallpaper_picker_package),
- "com.android.customization.picker.CustomizationPickerActivity"));
- }
/**
* Starts the details activity for {@code info}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 465df448e..f4968fa66 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -18,8 +18,10 @@ package com.android.launcher3.views;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextUtils;
@@ -152,9 +154,9 @@ public class OptionsPopupView extends ArrowPopup
RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
ArrayList<OptionItem> options = new ArrayList<>();
- int resString = Utilities.existsStyleWallpapers(launcher) ?
+ int resString = existsStyleWallpapers(launcher) ?
R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
- int resDrawable = Utilities.existsStyleWallpapers(launcher) ?
+ int resDrawable = existsStyleWallpapers(launcher) ?
R.drawable.ic_palette : R.drawable.ic_wallpaper;
options.add(new OptionItem(resString, resDrawable,
ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
@@ -168,6 +170,14 @@ public class OptionsPopupView extends ArrowPopup
show(launcher, target, options);
}
+ private static boolean existsStyleWallpapers(Launcher launcher) {
+ Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
+ intent.setComponent(new ComponentName(launcher.getString(R.string.wallpaper_picker_package),
+ "com.android.customization.picker.CustomizationPickerActivity"));
+ ResolveInfo ri = launcher.getPackageManager().resolveActivity(intent, 0);
+ return ri != null;
+ }
+
public static boolean onWidgetsClicked(View view) {
return openWidgets(Launcher.getLauncher(view.getContext())) != null;
}
@@ -205,7 +215,7 @@ public class OptionsPopupView extends ArrowPopup
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(EXTRA_WALLPAPER_OFFSET,
launcher.getWorkspace().getWallpaperOffsetForCenterPage());
- if (!Utilities.existsStyleWallpapers(launcher)) {
+ if (!existsStyleWallpapers(launcher)) {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
} else {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "focus_wallpaper");