Hide the DSULoader when DSU is running
Bug: 151792130 Test: open developer settings and check the DSULoader make -j32 RunSettingsRoboTests Change-Id: I8f82e0f7ddbfd2c50ac6e2a2d3f61f7715ba452c
This commit is contained in:
@@ -11745,6 +11745,8 @@
|
||||
<string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
|
||||
<!-- DSU Loader Loading. Do not translate. -->
|
||||
<string name="dsu_loader_loading" translatable="false">Loading...</string>
|
||||
<!-- DSU Loader. Do not translate. -->
|
||||
<string name="dsu_is_running" translatable="false">DSU is running</string>
|
||||
|
||||
<!-- Name of dev option called "Bug report handler" [CHAR LIMIT=NONE] -->
|
||||
<string name="bug_report_handler_title">Bug report handler</string>
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.development;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@@ -37,9 +38,16 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController
|
||||
return DSU_LOADER_KEY;
|
||||
}
|
||||
|
||||
private boolean isDSURunning() {
|
||||
return SystemProperties.getBoolean("ro.gsid.image_running", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (DSU_LOADER_KEY.equals(preference.getKey())) {
|
||||
if (isDSURunning()) {
|
||||
return true;
|
||||
}
|
||||
final Intent intent = new Intent(mContext, DSULoader.class);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
@@ -49,6 +57,7 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
preference.setSummary(mContext.getResources().getString(R.string.dsu_loader_description));
|
||||
int key = isDSURunning() ? R.string.dsu_is_running : R.string.dsu_loader_description;
|
||||
preference.setSummary(mContext.getResources().getString(key));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user