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

Commit 07251c82 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Remove the developer option to control Quarantine app state.

Bug: 305256093
Test: manual
Change-Id: I28cfb3f1e6c5d3bdab77b7eae2262a03909c45f7
parent 14f9f67d
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -12984,11 +12984,6 @@
    <!-- Developer settings: select Grammatical gender dialog title [CHAR LIMIT=50]-->
    <string name="grammatical_gender_dialog_title">Select Grammatical gender</string>
    <!-- Do not translate. Developer settings: Title for the screen allowing user to control Quarantined apps [CHAR LIMIT=50] -->
    <string name="quarantined_apps_title" translatable="false">Quarantined Apps</string>
    <!-- Do not translate. Developer settings: Button to unquarantine an app [CHAR LIMIT=20] -->
    <string name="unquarantine_app_button" translatable="false">Unquarantine app</string>
    <!-- Title of preference to manage content protection settings -->
    <string name="content_protection_preference_title">Scanning for deceptive apps</string>
    <!-- Summary of the preference to manage content protection settings -->
+0 −6
Original line number Diff line number Diff line
@@ -769,12 +769,6 @@
            android:title="@string/enable_notes_role_title"
            android:summary="@string/enable_notes_role_summary" />

        <Preference
            android:key="quarantined_apps"
            android:title="@string/quarantined_apps_title"
            settings:controller="com.android.settings.development.quarantine.QuarantinedAppsPreferenceController"
            android:fragment="com.android.settings.development.quarantine.QuarantinedAppsFragment" />

    </PreferenceCategory>

    <PreferenceCategory

res/xml/quarantined_apps.xml

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2023 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.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="quarantined_apps_screen"
    android:title="@string/quarantined_apps_title"
    settings:controller="com.android.settings.development.quarantine.QuarantinedAppsScreenController"
    settings:searchable="true">
</PreferenceScreen>
 No newline at end of file
+0 −4
Original line number Diff line number Diff line
# Bug component: 316234

sudheersai@google.com
yamasani@google.com
 No newline at end of file
+0 −76
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.quarantine;

import android.content.Context;
import android.graphics.drawable.Drawable;

import androidx.preference.PreferenceViewHolder;

import com.android.settings.R;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.AppSwitchPreference;

public class QuarantinedAppPreference extends AppSwitchPreference {
    private final AppEntry mEntry;
    private Drawable mCacheIcon;

    public QuarantinedAppPreference(Context context, AppEntry entry) {
        super(context);
        mEntry = entry;
        mCacheIcon = AppUtils.getIconFromCache(mEntry);

        mEntry.ensureLabel(context);
        setKey(generateKey(mEntry));
        if (mCacheIcon != null) {
            setIcon(mCacheIcon);
        } else {
            setIcon(R.drawable.empty_icon);
        }
        updateState();
    }

    static String generateKey(AppEntry entry) {
        return entry.info.packageName + "|" + entry.info.uid;
    }

    public AppEntry getEntry() {
        return mEntry;
    }

    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        if (mCacheIcon == null) {
            ThreadUtils.postOnBackgroundThread(() -> {
                final Drawable icon = AppUtils.getIcon(getContext(), mEntry);
                ThreadUtils.postOnMainThread(() -> {
                    setIcon(icon);
                    mCacheIcon = icon;
                });
            });
        }
        super.onBindViewHolder(holder);
    }

    void updateState() {
        setTitle(mEntry.label);
        setChecked((boolean) mEntry.extraInfo);
        notifyChanged();
    }
}
Loading