Files
app_Settings/src/com/android/settings/development/SelectDSUPreferenceController.java
Howard Chen d5f3a0ca75 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
2019-12-04 12:30:01 +08:00

55 lines
1.7 KiB
Java

/*
* 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 android.content.Context;
import android.content.Intent;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController {
private static final String DSU_LOADER_KEY = "dsu_loader";
SelectDSUPreferenceController(Context context) {
super(context);
}
@Override
public String getPreferenceKey() {
return DSU_LOADER_KEY;
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (DSU_LOADER_KEY.equals(preference.getKey())) {
final Intent intent = new Intent(mContext, DSULoader.class);
mContext.startActivity(intent);
return true;
}
return false;
}
@Override
public void updateState(Preference preference) {
preference.setSummary(mContext.getResources().getString(R.string.dsu_loader_description));
}
}