Add a GSI/DSU Loader to the developer option.
The Generic System Image (GSI) is a pure Android implementation with unmodified Android Open Source Project (AOSP) code. The Dynamic System Updates (DSU) is a Android Q feature that can download a system image and boot into it without the factory rom being corrupted. This CL adds a DSU Loader which is a friendly front-end that offers developers the ability to boot into GSI with one-click. The DSU loader also offers the flexibility to overwrite the default setting and load OEMs owned images. Bug: 140090894 Test: click settings->developer option->debug::DSU Loader make -j32 RunSettingsRoboTests Change-Id: Ia2a1b69b52047dd841dedf7f07b07f7ad3e65d46
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source 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.android.settings.development;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class SelectDSUPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
@Mock
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
|
||||
private Context mContext;
|
||||
private SelectDSUPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new SelectDSUPreferenceController(mContext);
|
||||
when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
|
||||
mPreference);
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChanged_settingEnabled_turnOnGpuViewUpdates() {
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
String flag = SystemProperties.get(DSULoader.PROPERTY_KEY_FEATURE_FLAG);
|
||||
assertThat(flag.equals("1")).isTrue();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user