diff --git a/res/xml/cherish_settings_misc.xml b/res/xml/cherish_settings_misc.xml
index 31ac5ce..e61f547 100644
--- a/res/xml/cherish_settings_misc.xml
+++ b/res/xml/cherish_settings_misc.xml
@@ -34,10 +34,11 @@
-
+ android:summary="@string/display_cutout_force_fullscreen_summary">
+
+
entries) {
final ArrayList sections = new ArrayList();
final ArrayList positions = new ArrayList();
- final PackageManager pm = getPackageManager();
+ final PackageManager pm = getActivity().getPackageManager();
String lastSectionIndex = null;
int offset = 0;
@@ -349,28 +353,15 @@ public class DisplayCutoutForceFullscreenSettings extends SettingsPreferenceFrag
@Override
public void init() {}
- private final String[] hideApps = {"com.android.settings", "com.android.documentsui",
- "com.android.fmradio", "com.caf.fmradio", "com.android.stk",
- "com.google.android.calculator", "com.google.android.calendar",
- "com.google.android.deskclock", "com.google.android.contacts",
- "com.google.android.apps.messaging", "com.google.android.googlequicksearchbox",
- "com.android.vending", "com.google.android.dialer",
- "com.google.android.apps.wallpaper", "com.google.android.as"};
-
@Override
public boolean filterApp(ApplicationsState.AppEntry entry) {
boolean show = !mAllPackagesAdapter.mEntries.contains(entry.info.packageName);
if (show) {
synchronized (mLauncherResolveInfoList) {
- show = mLauncherResolveInfoList.contains(entry.info.packageName) && !Arrays.asList(hideApps).contains(entry.info.packageName);
+ show = mLauncherResolveInfoList.contains(entry.info.packageName) && !entry.info.isSystemApp();
}
}
return show;
}
}
-
- @Override
- public int getMetricsCategory() {
- return MetricsEvent.CHERISH_SETTINGS;
- }
-}
+}
\ No newline at end of file
diff --git a/src/com/cherish/settings/fragments/MiscSettings.java b/src/com/cherish/settings/fragments/MiscSettings.java
index 433920d..75a50af 100644
--- a/src/com/cherish/settings/fragments/MiscSettings.java
+++ b/src/com/cherish/settings/fragments/MiscSettings.java
@@ -45,12 +45,14 @@ import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class MiscSettings extends SettingsPreferenceFragment implements
OnPreferenceChangeListener {
-
+
+ private static final String KEY_FORCE_FULL_SCREEN = "display_cutout_force_fullscreen_settings";
private static final String KEY_PHOTOS_SPOOF = "use_photos_spoof";
private static final String KEY_STREAM_SPOOF = "use_stream_spoof";
private static final String SYS_PHOTOS_SPOOF = "persist.sys.photo";
private static final String SYS_STREAM_SPOOF = "persist.sys.stream";
+ private Preference mShowCutoutForce;
private SwitchPreference mPhotosSpoof;
private SwitchPreference mStreamSpoof;
@@ -62,6 +64,14 @@ public class MiscSettings extends SettingsPreferenceFragment implements
addPreferencesFromResource(R.xml.cherish_settings_misc);
final PreferenceScreen prefSet = getPreferenceScreen();
+ Context mContext = getActivity().getApplicationContext();
+
+ final String displayCutout =
+ mContext.getResources().getString(com.android.internal.R.string.config_mainBuiltInDisplayCutout);
+ mShowCutoutForce = (Preference) findPreference(KEY_FORCE_FULL_SCREEN);
+ if (TextUtils.isEmpty(displayCutout)) {
+ prefSet.removePreference(mShowCutoutForce);
+ }
final String usePhotosSpoof = SystemProperties.get(SYS_PHOTOS_SPOOF, "1");
mPhotosSpoof = (SwitchPreference) findPreference(KEY_PHOTOS_SPOOF);
@@ -136,6 +146,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
@Override
public List getNonIndexableKeys(Context context) {
List keys = super.getNonIndexableKeys(context);
+ final String displayCutout =
+ context.getResources().getString(com.android.internal.R.string.config_mainBuiltInDisplayCutout);
+
+ if (TextUtils.isEmpty(displayCutout)) {
+ keys.add(KEY_FORCE_FULL_SCREEN);
+ }
return keys;
}
};
diff --git a/src/com/cherish/settings/fragments/ui/DisplayCutoutForceFullscreenPreferenceController.java b/src/com/cherish/settings/fragments/ui/DisplayCutoutForceFullscreenPreferenceController.java
deleted file mode 100644
index d84bb68..0000000
--- a/src/com/cherish/settings/fragments/ui/DisplayCutoutForceFullscreenPreferenceController.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2019 The PixelExperience 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.
- */
-
-package com.cherish.settings.fragments;
-
-import android.content.Context;
-import android.provider.Settings;
-import android.os.Handler;
-import android.os.UserHandle;
-
-import com.android.internal.util.cherish.cutout.CutoutFullscreenController;
-
-import com.android.settings.core.BasePreferenceController;
-
-public class DisplayCutoutForceFullscreenPreferenceController extends BasePreferenceController {
-
- private static final String PREF_KEY = "display_cutout_force_fullscreen_settings";
- private CutoutFullscreenController mCutoutForceFullscreenSettings;
-
- public DisplayCutoutForceFullscreenPreferenceController(Context context) {
- super(context, PREF_KEY);
- mCutoutForceFullscreenSettings = new CutoutFullscreenController(new Handler(), context);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return mCutoutForceFullscreenSettings.isSupported() ?
- AVAILABLE : UNSUPPORTED_ON_DEVICE;
- }
-}