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

Commit 9d3ac418 authored by Adnan Begovic's avatar Adnan Begovic
Browse files

Settings: Dissallow privacy guarding system apps on overlay.

  Bandaid fix for google play services inundating the permission
  dialog request queue within AppOps service and causing watchdog
  to consistently kill the system server's activity manager service
  which is deadlocked retrieving dialogs from the queue.

Change-Id: I10c432cebe6a4199517839598046eee7d19dcf72
TICKET: CYNGNOS-2869
(cherry picked from commit be7d45fd)
parent ded732b2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -122,4 +122,7 @@

    <!-- When true, weather options will be displayed in settings dashboard -->
    <bool name="config_showWeatherMenu">true</bool>

    <!-- When true, "show built-in" option in Privacy Guard will be available -->
    <bool name="config_showBuiltInAppsForPG">true</bool>
</resources>
+8 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceFrameLayout;
import android.support.v13.app.FragmentPagerAdapter;
@@ -186,7 +187,8 @@ public class AppOpsSummary extends InstrumentedFragment {
    }

    private boolean shouldShowSystemApps() {
        return mPreferences.getBoolean("show_system_apps", true);
        return mPreferences.getBoolean("show_system_apps", true) &&
                mActivity.getResources().getBoolean(R.bool.config_showBuiltInAppsForPG);
    }

    @Override
@@ -204,8 +206,12 @@ public class AppOpsSummary extends InstrumentedFragment {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.appops_manager, menu);
        menu.findItem(R.id.show_user_apps).setChecked(shouldShowUserApps());
        if (!mActivity.getResources().getBoolean(R.bool.config_showBuiltInAppsForPG)) {
            menu.removeItem(R.id.show_system_apps);
        } else {
            menu.findItem(R.id.show_system_apps).setChecked(shouldShowSystemApps());
        }
    }

    private void resetCounters() {
        final AppOpsManager appOps =
+8 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings.privacyguard;

import android.app.FragmentTransaction;
import android.os.Build;
import android.view.animation.AnimationUtils;
import android.app.Activity;
import android.app.AlertDialog;
@@ -297,9 +298,9 @@ public class PrivacyGuardManager extends Fragment
        return true;
    }


    private boolean shouldShowSystemApps() {
        return mPreferences.getBoolean("show_system_apps", false);
        return mPreferences.getBoolean("show_system_apps", true) &&
                mActivity.getResources().getBoolean(R.bool.config_showBuiltInAppsForPG);
    }

    public static class HelpDialogFragment extends DialogFragment {
@@ -372,8 +373,12 @@ public class PrivacyGuardManager extends Fragment
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.privacy_guard_manager, menu);
        if (!mActivity.getResources().getBoolean(R.bool.config_showBuiltInAppsForPG)) {
            menu.removeItem(R.id.show_system_apps);
        } else {
            menu.findItem(R.id.show_system_apps).setChecked(shouldShowSystemApps());
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {