Re-enable the test
Update the test to handle new API and simplify the logic in the controller. Bug: 130897305 Test: make RunSettingsRoboTests -j64 Change-Id: I0c46ff22d4a3bf913add753f85a24af9aeee0a33
This commit is contained in:
@@ -20,9 +20,6 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
|
||||
@@ -60,10 +57,12 @@ public class AdaptiveSleepPreferenceController extends TogglePreferenceControlle
|
||||
@Override
|
||||
@AvailabilityStatus
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_adaptive_sleep_available)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
final boolean supportedOnDevice = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_adaptive_sleep_available);
|
||||
if (!supportedOnDevice) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
return hasSufficientPermissions ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,15 +76,4 @@ public class AdaptiveSleepPreferenceController extends TogglePreferenceControlle
|
||||
? R.string.adaptive_sleep_summary_on
|
||||
: R.string.adaptive_sleep_summary_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
final Preference preference = screen.findPreference(SYSTEM_KEY);
|
||||
|
||||
if (preference != null) {
|
||||
preference.setEnabled(hasSufficientPermissions);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user