From 468651c86a8adb7aa56c708d2348e99022088af3 Mon Sep 17 00:00:00 2001
From: Hall Liu <hallliu@google.com>
Date: Thu, 2 Jun 2016 10:32:08 -0700
Subject: DO NOT MERGE Disable app pinning when emergency call button pressed

Also disables app pinning when the "return to call" button is pressed
and brings up the in-call screen when app pinning is stopped if there is
an existing call.

Combination of ag/1091397 and ag/1085584 adapted for MNC.

Bug: 28558307
Bug: 28761672
Change-Id: I82ec4042bff387c845ce571b197a4a86e1dd5ec8
---
 .../Keyguard/src/com/android/keyguard/EmergencyButton.java     | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'packages')

diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index cbf22c0..93809af 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -16,15 +16,18 @@
 
 package com.android.keyguard;
 
+import android.app.ActivityManagerNative;
 import android.app.ActivityOptions;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.os.PowerManager;
+import android.os.RemoteException;
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.telecom.TelecomManager;
 import android.util.AttributeSet;
+import android.util.Slog;
 import android.view.View;
 import android.widget.Button;
 
@@ -46,6 +49,8 @@ public class EmergencyButton extends Button {
                     | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                     | Intent.FLAG_ACTIVITY_CLEAR_TOP);
 
+    private static final String LOG_TAG = "EmergencyButton";
+
     KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
 
         @Override
@@ -121,6 +126,11 @@ public class EmergencyButton extends Button {
         // TODO: implement a shorter timeout once new PowerManager API is ready.
         // should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
         mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
+        try {
+            ActivityManagerNative.getDefault().stopLockTaskMode();
+        } catch (RemoteException e) {
+            Slog.w(LOG_TAG, "Failed to stop app pinning");
+        }
         if (isInCall()) {
             resumeCall();
             if (mEmergencyButtonCallback != null) {
-- 
cgit v1.1


From 01875b0274e74f97edf6b0d5c92de822e0555d03 Mon Sep 17 00:00:00 2001
From: Sudheer Shanka <sudheersai@google.com>
Date: Wed, 8 Jun 2016 17:13:24 -0700
Subject: Reduce shell power over user management.

Remove MANAGE_USERS permission from shell and whitelist it for
some specific functionality.

Bug: 29189712
Change-Id: Ifb37448c091af91991964511e3efb1bb4dea1ff3
---
 packages/Shell/AndroidManifest.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'packages')

diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index b9daf59..6a20733 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -89,7 +89,7 @@
     <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
     <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
     <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
-    <uses-permission android:name="android.permission.MANAGE_USERS" />
+    <uses-permission android:name="android.permission.CREATE_USERS" />
     <uses-permission android:name="android.permission.MANAGE_DEVICE_ADMINS" />
     <uses-permission android:name="android.permission.BLUETOOTH_STACK" />
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-- 
cgit v1.1