Only show graphics driver option when the apk is available.
Previously we always show all options, this patch makes the dashboard only shows the option when the driver apk is available. Bug: b/148626177 Test: make RunSettingsRoboTests ROBOTEST_FILTER=GraphicsDriver Change-Id: Ifde5929d826d5ab542e855aa334546dd744b138b
This commit is contained in:
@@ -26,9 +26,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.ListPreference;
|
||||
@@ -60,9 +58,6 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
||||
GraphicsDriverContentObserver.OnGraphicsDriverContentChangedListener, LifecycleObserver,
|
||||
OnStart, OnStop {
|
||||
|
||||
private static final String PROPERTY_GFX_DRIVER_GAME = "ro.gfx.driver.0";
|
||||
private static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
|
||||
|
||||
private final Context mContext;
|
||||
private final ContentResolver mContentResolver;
|
||||
private final String mPreferenceTitle;
|
||||
@@ -98,7 +93,8 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
||||
mPreferencePrereleaseDriver =
|
||||
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
||||
mPreferenceSystem = resources.getString(R.string.graphics_driver_app_preference_system);
|
||||
mEntryList = constructEntryList();
|
||||
mEntryList = GraphicsDriverEnableForAllAppsPreferenceController.constructEntryList(
|
||||
mContext, true);
|
||||
|
||||
// TODO: Move this task to background if there's potential ANR/Jank.
|
||||
// Update the UI when all the app infos are ready.
|
||||
@@ -195,28 +191,6 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
||||
updateState(mPreferenceGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs and returns a list of graphics driver choices.
|
||||
*/
|
||||
public CharSequence[] constructEntryList() {
|
||||
final String prereleaseDriverPackageName =
|
||||
SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
|
||||
final String gameDriverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER_GAME);
|
||||
|
||||
List<CharSequence> entryList = new ArrayList<>();
|
||||
entryList.add(mPreferenceDefault);
|
||||
if (!TextUtils.isEmpty(prereleaseDriverPackageName)) {
|
||||
entryList.add(mPreferencePrereleaseDriver);
|
||||
}
|
||||
if (!TextUtils.isEmpty(gameDriverPackageName)) {
|
||||
entryList.add(mPreferenceGameDriver);
|
||||
}
|
||||
entryList.add(mPreferenceSystem);
|
||||
CharSequence[] filteredEntryList = new CharSequence[entryList.size()];
|
||||
filteredEntryList = entryList.toArray(filteredEntryList);
|
||||
return filteredEntryList;
|
||||
}
|
||||
|
||||
// AppInfo class to achieve loading the application label only once
|
||||
class AppInfo {
|
||||
AppInfo(PackageManager packageManager, ApplicationInfo applicationInfo) {
|
||||
|
||||
Reference in New Issue
Block a user