Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ba7fa97 authored by PO HUNG CHEN's avatar PO HUNG CHEN Committed by Android (Google) Code Review
Browse files

Merge "Hide the DSULoader when DSU is running" into rvc-dev

parents 68084f39 01871ab4
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -11837,6 +11837,8 @@
    <string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
    <string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
    <!-- DSU Loader Loading. Do not translate. -->
    <!-- DSU Loader Loading. Do not translate. -->
    <string name="dsu_loader_loading" translatable="false">Loading...</string>
    <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] -->
    <!-- Name of dev option called "Bug report handler" [CHAR LIMIT=NONE] -->
    <string name="bug_report_handler_title">Bug report handler</string>
    <string name="bug_report_handler_title">Bug report handler</string>
+10 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings.development;


import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.os.SystemProperties;


import androidx.preference.Preference;
import androidx.preference.Preference;


@@ -37,9 +38,16 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController
        return DSU_LOADER_KEY;
        return DSU_LOADER_KEY;
    }
    }


    private boolean isDSURunning() {
        return SystemProperties.getBoolean("ro.gsid.image_running", false);
    }

    @Override
    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (DSU_LOADER_KEY.equals(preference.getKey())) {
        if (DSU_LOADER_KEY.equals(preference.getKey())) {
            if (isDSURunning()) {
                return true;
            }
            final Intent intent = new Intent(mContext, DSULoader.class);
            final Intent intent = new Intent(mContext, DSULoader.class);
            mContext.startActivity(intent);
            mContext.startActivity(intent);
            return true;
            return true;
@@ -49,6 +57,7 @@ class SelectDSUPreferenceController extends DeveloperOptionsPreferenceController


    @Override
    @Override
    public void updateState(Preference preference) {
    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));
    }
    }
}
}