diff options
author | Adrian Roos <roosa@google.com> | 2014-11-27 13:00:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-27 13:01:01 +0000 |
commit | 09eeab7cbffae64add657f1a1e7ab6c7f20b6d9b (patch) | |
tree | 321131ebba3e90af4656fa9fe002dfba2be6d10f /packages | |
parent | 7028dec6ca10cdc63966dad01e59cdbabd6a0a1d (diff) | |
parent | 752aee8a6f868011dea1d1bb4f582a2531d76d47 (diff) | |
download | frameworks_base-09eeab7cbffae64add657f1a1e7ab6c7f20b6d9b.zip frameworks_base-09eeab7cbffae64add657f1a1e7ab6c7f20b6d9b.tar.gz frameworks_base-09eeab7cbffae64add657f1a1e7ab6c7f20b6d9b.tar.bz2 |
Merge "Fix projection permission dialog layering" into lmp-mr1-dev
Diffstat (limited to 'packages')
3 files changed, 46 insertions, 20 deletions
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 0cbbf87..0e69f74 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -266,7 +266,7 @@ <activity android:name=".media.MediaProjectionPermissionActivity" android:exported="true" - android:theme="@style/Theme.SystemUI.Dialog.Alert" + android:theme="@style/Theme.AlertDialogHost" android:finishOnCloseSystemDialogs="true" android:launchMode="singleTop" android:excludeFromRecents="true" /> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 8d1e967..09b240b 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -262,4 +262,14 @@ <style name="UserDetailView"> <item name="numColumns">3</item> </style> + + <style name="Theme.AlertDialogHost" parent="android:Theme.DeviceDefault"> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowNoTitle">true</item> + <item name="android:windowIsFloating">true</item> + <item name="android:backgroundDimEnabled">false</item> + <item name="android:alertDialogTheme">@style/Theme.SystemUI.Dialog.Alert</item> + </style> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java index b441eaa..25bab17 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java @@ -16,6 +16,7 @@ package com.android.systemui.media; +import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent; import android.content.Context; @@ -32,6 +33,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import android.view.LayoutInflater; +import android.view.WindowManager; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; @@ -39,9 +41,11 @@ import android.widget.TextView; import com.android.internal.app.AlertActivity; import com.android.internal.app.AlertController; import com.android.systemui.R; +import com.android.systemui.statusbar.phone.SystemUIDialog; -public class MediaProjectionPermissionActivity extends AlertActivity - implements DialogInterface.OnClickListener, CheckBox.OnCheckedChangeListener { +public class MediaProjectionPermissionActivity extends Activity + implements DialogInterface.OnClickListener, CheckBox.OnCheckedChangeListener, + DialogInterface.OnCancelListener { private static final String TAG = "MediaProjectionPermissionActivity"; private boolean mPermanentGrant; @@ -49,11 +53,12 @@ public class MediaProjectionPermissionActivity extends AlertActivity private int mUid; private IMediaProjectionManager mService; + private AlertDialog mDialog; + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - Intent intent = getIntent(); mPackageName = getCallingPackage(); IBinder b = ServiceManager.getService(MEDIA_PROJECTION_SERVICE); mService = IMediaProjectionManager.Stub.asInterface(b); @@ -89,22 +94,27 @@ public class MediaProjectionPermissionActivity extends AlertActivity String appName = aInfo.loadLabel(packageManager).toString(); - final AlertController.AlertParams ap = mAlertParams; - ap.mIcon = aInfo.loadIcon(packageManager); - ap.mMessage = getString(R.string.media_projection_dialog_text, appName); - ap.mPositiveButtonText = getString(R.string.media_projection_action_text); - ap.mNegativeButtonText = getString(android.R.string.cancel); - ap.mPositiveButtonListener = this; - ap.mNegativeButtonListener = this; - - // add "always use" checkbox - LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); - ap.mView = inflater.inflate(R.layout.remember_permission_checkbox, null); - CheckBox rememberPermissionCheckbox = - (CheckBox)ap.mView.findViewById(R.id.remember); - rememberPermissionCheckbox.setOnCheckedChangeListener(this); - - setupAlert(); + mDialog = new AlertDialog.Builder(this) + .setIcon(aInfo.loadIcon(packageManager)) + .setMessage(getString(R.string.media_projection_dialog_text, appName)) + .setPositiveButton(R.string.media_projection_action_text, this) + .setNegativeButton(android.R.string.cancel, this) + .setView(R.layout.remember_permission_checkbox) + .setOnCancelListener(this) + .create(); + + mDialog.create(); + + ((CheckBox) mDialog.findViewById(R.id.remember)).setOnCheckedChangeListener(this); + mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); + + mDialog.show(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mDialog.dismiss(); } @Override @@ -118,6 +128,7 @@ public class MediaProjectionPermissionActivity extends AlertActivity Log.e(TAG, "Error granting projection permission", e); setResult(RESULT_CANCELED); } finally { + mDialog.dismiss(); finish(); } } @@ -135,4 +146,9 @@ public class MediaProjectionPermissionActivity extends AlertActivity intent.putExtra(MediaProjectionManager.EXTRA_MEDIA_PROJECTION, projection.asBinder()); return intent; } + + @Override + public void onCancel(DialogInterface dialog) { + finish(); + } } |