Create shell UI for smart battery saver
This CL creates the new screen WITHOUT any of the behaviors (changing the global settings/calling power manager apis) and hooks it up to the preference in BatterySaverSettings for navigation. The logic for the preference in BatterySaver Settings is also added so that it shows the correct summary when the schedule settings are modified. Additionally, a small tweak is made to the radio preference widget to make it possible to hide the appendix view. It didn't seem to do anything except get in the way and potentially ruin your day, much like its biological counterpart. Test: Overriding power mode via adb, robotests Bug: 111450127 Change-Id: Ic681aaf565ce1caf7d00d314e14ae6c4779fe8f6
This commit is contained in:
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Application;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
@@ -93,4 +94,13 @@ public class RadioButtonPreferenceTest {
|
||||
mPreference.onBindViewHolder(preferenceViewHolder);
|
||||
assertEquals(View.GONE, summaryContainer.getVisibility());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hideAppendix_shouldBeGone() {
|
||||
mPreference.setAppendixVisibility(View.GONE);
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.preference_radio, null);
|
||||
PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(view);
|
||||
mPreference.onBindViewHolder(holder);
|
||||
assertThat(holder.findViewById(R.id.appendix).getVisibility()).isEqualTo(View.GONE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user