diff options
| author | 2022-10-25 16:31:58 -0700 | |
|---|---|---|
| committer | 2022-11-07 19:54:17 +0000 | |
| commit | fc13cb1d680d57ea6401e2d45dfb1e46bf046fc7 (patch) | |
| tree | dddc028f7a64587237d107e96c04cb2f54c734a9 | |
| parent | 05d894c1b37202d9052ec0bd8e126b424776f962 (diff) | |
Generate consent dialog when device log access is requested in SystemUI
This change is to implement device log access dialog from SystemUI rather than
system server.
Bug: 238434889, 244173014
Test: GtsVerifier
Ignore-AOSP-First: migration of device log access dialog
Change-Id: I17058c008084f91099cd45a51ec8d8fbab1d78bb
19 files changed, 150 insertions, 124 deletions
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index f0fbff1e63e2..87f47a4f33f8 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -6908,13 +6908,6 @@ android:exported="false"> </activity> - <activity android:name="com.android.internal.app.LogAccessDialogActivity" - android:theme="@style/Theme.Translucent.NoTitleBar" - android:process=":ui" - android:excludeFromRecents="true" - android:exported="false"> - </activity> - <activity android:name="com.android.server.notification.NASLearnMoreActivity" android:theme="@style/Theme.Dialog.Confirmation" android:excludeFromRecents="true" diff --git a/core/res/res/values-television/styles.xml b/core/res/res/values-television/styles.xml deleted file mode 100644 index ad9140cdc6a9..000000000000 --- a/core/res/res/values-television/styles.xml +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - ~ Copyright (C) 2022 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. - --> -<resources> - <style name="PermissionGrantButtonTop" - parent="@style/Widget.Leanback.Button.ButtonBarGravityStart" /> - <style name="PermissionGrantButtonBottom" - parent="@style/Widget.Leanback.Button.ButtonBarGravityStart" /> -</resources>
\ No newline at end of file diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 1f459c6f623d..3260420dedd0 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5759,32 +5759,6 @@ <!-- Title for the harmful app warning dialog. [CHAR LIMIT=40] --> <string name="harmful_app_warning_title">Harmful app detected</string> - <!-- Title for the log access confirmation dialog. [CHAR LIMIT=NONE] --> - <string name="log_access_confirmation_title">Allow <xliff:g id="log_access_app_name" example="Example App">%s</xliff:g> to access all device logs?</string> - <!-- Label for the allow button on the log access confirmation dialog. [CHAR LIMIT=40] --> - <string name="log_access_confirmation_allow">Allow one-time access</string> - <!-- Label for the deny button on the log access confirmation dialog. [CHAR LIMIT=20] --> - <string name="log_access_confirmation_deny">Don\u2019t allow</string> - - <!-- Content for the log access confirmation dialog. [CHAR LIMIT=NONE]--> - <string name="log_access_confirmation_body" product="default">Device logs record what happens on your device. Apps can use these logs to find and fix issues.\n\nSome logs may contain sensitive info, so only allow apps you trust to access all device logs. - \n\nIf you don’t allow this app to access all device logs, it can still access its own logs. Your device manufacturer may still be able to access some logs or info on your device. - </string> - - <!-- Content for the log access confirmation dialog. [CHAR LIMIT=NONE]--> - <string name="log_access_confirmation_body" product="tv">Device logs record what happens on your device. Apps can use these logs to find and fix issues.\n\nSome logs may contain sensitive info, so only allow apps you trust to access all device logs. - \n\nIf you don’t allow this app to access all device logs, it can still access its own logs. Your device manufacturer may still be able to access some logs or info on your device.\n\nLearn more at g.co/android/devicelogs. - </string> - - <!-- Learn more URL for the log access confirmation dialog. [DO NOT TRANSLATE]--> - <string name="log_access_confirmation_learn_more" product="default" translatable="false"><a href="https://support.google.com/android?p=system_logs#topic=7313011">Learn more</a></string> - - <!-- Learn more URL for the log access confirmation dialog. [DO NOT TRANSLATE]--> - <string name="log_access_confirmation_learn_more" product="tv" translatable="false"></string> - - <!-- Privacy notice do not show [CHAR LIMIT=20] --> - <string name="log_access_do_not_show_again">Don\u2019t show again</string> - <!-- Text describing a permission request for one app to show another app's slices [CHAR LIMIT=NONE] --> <string name="slices_permission_request"><xliff:g id="app" example="Example App">%1$s</xliff:g> wants to show <xliff:g id="app_2" example="Other Example App">%2$s</xliff:g> slices</string> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 2dd563d0b843..476c18ee0c6c 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1541,40 +1541,4 @@ please see styles_device_defaults.xml. <style name="NotificationTombstoneAction" parent="NotificationAction"> <item name="textColor">#555555</item> </style> - - <!-- The style for log access consent text --> - <style name="AllowLogAccess"> - <item name="android:textSize">24sp</item> - <item name="android:fontFamily">google-sans</item> - </style> - - <style name="PrimaryAllowLogAccess"> - <item name="android:textSize">14sp</item> - <item name="android:fontFamily">google-sans-text</item> - </style> - - <style name="PermissionGrantButtonTextAppearance"> - <item name="android:fontFamily">google-sans-medium</item> - <item name="android:textSize">14sp</item> - <item name="android:textColor">@android:color/system_neutral1_900</item> - </style> - - <style name="PermissionGrantButtonTop" - parent="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"> - <item name="android:layout_width">332dp</item> - <item name="android:layout_height">56dp</item> - <item name="android:layout_marginTop">2dp</item> - <item name="android:layout_marginBottom">2dp</item> - <item name="android:background">@drawable/grant_permissions_buttons_top</item> - </style> - - <style name="PermissionGrantButtonBottom" - parent="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"> - <item name="android:layout_width">332dp</item> - <item name="android:layout_height">56dp</item> - <item name="android:layout_marginTop">2dp</item> - <item name="android:layout_marginBottom">2dp</item> - <item name="android:background">@drawable/grant_permissions_buttons_bottom</item> - </style> - </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 54e4074376eb..7b6284196bfd 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3938,17 +3938,6 @@ <java-symbol type="string" name="harmful_app_warning_title" /> <java-symbol type="layout" name="harmful_app_warning_dialog" /> - <java-symbol type="string" name="log_access_confirmation_allow" /> - <java-symbol type="string" name="log_access_confirmation_deny" /> - <java-symbol type="string" name="log_access_confirmation_title" /> - <java-symbol type="string" name="log_access_confirmation_body" /> - <java-symbol type="string" name="log_access_confirmation_learn_more" /> - <java-symbol type="layout" name="log_access_user_consent_dialog_permission" /> - <java-symbol type="id" name="log_access_dialog_title" /> - <java-symbol type="id" name="log_access_dialog_body" /> - <java-symbol type="id" name="log_access_dialog_allow_button" /> - <java-symbol type="id" name="log_access_dialog_deny_button" /> - <java-symbol type="string" name="config_defaultAssistantAccessComponent" /> <java-symbol type="string" name="slices_permission_request" /> diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 07e37d3f67d6..61df65aff8d7 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -986,5 +986,11 @@ <action android:name="com.android.systemui.action.DISMISS_VOLUME_PANEL_DIALOG" /> </intent-filter> </receiver> + + <activity android:name=".logcat.LogAccessDialogActivity" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:excludeFromRecents="true" + android:exported="false"> + </activity> </application> </manifest> diff --git a/core/res/res/drawable/grant_permissions_buttons_bottom.xml b/packages/SystemUI/res/drawable/grant_permissions_buttons_bottom.xml index a800f15b297e..a800f15b297e 100644 --- a/core/res/res/drawable/grant_permissions_buttons_bottom.xml +++ b/packages/SystemUI/res/drawable/grant_permissions_buttons_bottom.xml diff --git a/core/res/res/drawable/grant_permissions_buttons_top.xml b/packages/SystemUI/res/drawable/grant_permissions_buttons_top.xml index 2bf803e340ec..2bf803e340ec 100644 --- a/core/res/res/drawable/grant_permissions_buttons_top.xml +++ b/packages/SystemUI/res/drawable/grant_permissions_buttons_top.xml diff --git a/packages/SystemUI/res/drawable/ic_doc_document.xml b/packages/SystemUI/res/drawable/ic_doc_document.xml new file mode 100644 index 000000000000..df9ddab9fdb0 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_doc_document.xml @@ -0,0 +1,24 @@ +<!-- +Copyright (C) 2022 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF4883F3" + android:pathData="M19 3H5c-1.1 0,-2 .9,-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2,-.9 2,-2V5c0,-1.1,-.9,-2,-2,-2zm-1.99 6H7V7h10.01v2zm0 4H7v-2h10.01v2zm-3 4H7v-2h7.01v2z"/> +</vector> diff --git a/core/res/res/layout/log_access_user_consent_dialog_permission.xml b/packages/SystemUI/res/layout/log_access_user_consent_dialog_permission.xml index 3da14c8f1886..89e36ac93387 100644 --- a/core/res/res/layout/log_access_user_consent_dialog_permission.xml +++ b/packages/SystemUI/res/layout/log_access_user_consent_dialog_permission.xml @@ -75,7 +75,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/log_access_confirmation_allow" - style="@style/PermissionGrantButtonTop" + style="?permissionGrantButtonTopStyle" android:textAppearance="@style/PermissionGrantButtonTextAppearance" android:layout_marginBottom="5dp" android:layout_centerHorizontal="true" @@ -89,7 +89,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/log_access_confirmation_deny" - style="@style/PermissionGrantButtonBottom" + style="?permissionGrantButtonBottomStyle" android:textAppearance="@style/PermissionGrantButtonTextAppearance" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" diff --git a/packages/SystemUI/res/values-television/strings.xml b/packages/SystemUI/res/values-television/strings.xml new file mode 100644 index 000000000000..f30b73ea6f13 --- /dev/null +++ b/packages/SystemUI/res/values-television/strings.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright (c) 2022, 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. + */ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Content for the log access confirmation dialog. [CHAR LIMIT=NONE]--> + <string name="log_access_confirmation_body">Device logs record what happens on your device. Apps can use these logs to find and fix issues.\n\nSome logs may contain sensitive info, so only allow apps you trust to access all device logs. + \n\nIf you don’t allow this app to access all device logs, it can still access its own logs. Your device manufacturer may still be able to access some logs or info on your device.\n\nLearn more at g.co/android/devicelogs. + </string> + + <!-- Learn more URL for the log access confirmation dialog. [DO NOT TRANSLATE]--> + <string name="log_access_confirmation_learn_more" translatable="false"></string> +</resources>
\ No newline at end of file diff --git a/packages/SystemUI/res/values-television/styles.xml b/packages/SystemUI/res/values-television/styles.xml index 12020f946103..c517845c582f 100644 --- a/packages/SystemUI/res/values-television/styles.xml +++ b/packages/SystemUI/res/values-television/styles.xml @@ -63,4 +63,10 @@ <item name="android:paddingVertical">@dimen/bottom_sheet_button_padding_vertical</item> <item name="android:stateListAnimator">@anim/tv_bottom_sheet_button_state_list_animator</item> </style> + + <!-- The style for log access consent button --> + <style name="LogAccessDialogTheme" parent="@android:style/Theme.DeviceDefault.Dialog.Alert"> + <item name="permissionGrantButtonTopStyle">?android:buttonBarButtonStyle</item> + <item name="permissionGrantButtonBottomStyle">?android:buttonBarButtonStyle</item> + </style> </resources> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index df0659d67afe..44ba3f6e6d86 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -204,5 +204,10 @@ <attr name="passwordTextAppearance" format="reference" /> <attr name="errorTextAppearance" format="reference"/> </declare-styleable> + + <declare-styleable name="LogAccessPermissionGrantDialog"> + <attr name="permissionGrantButtonTopStyle" format="reference"/> + <attr name="permissionGrantButtonBottomStyle" format="reference"/> + </declare-styleable> </resources> diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml index 4fd25a98a71c..2b6ab305542f 100644 --- a/packages/SystemUI/res/values/ids.xml +++ b/packages/SystemUI/res/values/ids.xml @@ -195,5 +195,7 @@ <item type="id" name="pm_lite"/> <item type="id" name="settings_button_container"/> + <item type="id" name="log_access_dialog_allow_button" /> + <item type="id" name="log_access_dialog_deny_button" /> </resources> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index cbcfbf83c801..5778e72d424b 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2770,4 +2770,19 @@ <!-- Time format for the Dream Time Complication for 24-hour time format [CHAR LIMIT=NONE] --> <string name="dream_time_complication_24_hr_time_format">kk:mm</string> + + <!-- Title for the log access confirmation dialog. [CHAR LIMIT=NONE] --> + <string name="log_access_confirmation_title">Allow <xliff:g id="log_access_app_name" example="Example App">%s</xliff:g> to access all device logs?</string> + <!-- Label for the allow button on the log access confirmation dialog. [CHAR LIMIT=40] --> + <string name="log_access_confirmation_allow">Allow one-time access</string> + <!-- Label for the deny button on the log access confirmation dialog. [CHAR LIMIT=20] --> + <string name="log_access_confirmation_deny">Don\u2019t allow</string> + + <!-- Content for the log access confirmation dialog. [CHAR LIMIT=NONE]--> + <string name="log_access_confirmation_body">Device logs record what happens on your device. Apps can use these logs to find and fix issues.\n\nSome logs may contain sensitive info, so only allow apps you trust to access all device logs. + \n\nIf you don’t allow this app to access all device logs, it can still access its own logs. Your device manufacturer may still be able to access some logs or info on your device. + </string> + + <!-- Learn more URL for the log access confirmation dialog. [DO NOT TRANSLATE]--> + <string name="log_access_confirmation_learn_more" translatable="false"><a href="https://support.google.com/android?p=system_logs#topic=7313011">Learn more</a></string> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index e76887babc50..4e4bfe2ee8f3 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -1274,4 +1274,45 @@ <item name="android:textColor">?androidprv:attr/textColorOnAccent</item> <item name="android:textSize">@dimen/broadcast_dialog_btn_text_size</item> </style> + + + <!-- The style for log access consent dialog --> + <style name="LogAccessDialogTheme" parent="@style/Theme.SystemUI.Dialog.Alert"> + <item name="permissionGrantButtonTopStyle">@style/PermissionGrantButtonTop</item> + <item name="permissionGrantButtonBottomStyle">@style/PermissionGrantButtonBottom</item> + </style> + + <style name="AllowLogAccess"> + <item name="android:textSize">24sp</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> + </style> + + <style name="PrimaryAllowLogAccess"> + <item name="android:textSize">14sp</item> + <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> + </style> + + <style name="PermissionGrantButtonTextAppearance"> + <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> + <item name="android:textSize">14sp</item> + <item name="android:textColor">@android:color/system_neutral1_900</item> + </style> + + <style name="PermissionGrantButtonTop" + parent="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"> + <item name="android:layout_width">332dp</item> + <item name="android:layout_height">56dp</item> + <item name="android:layout_marginTop">2dp</item> + <item name="android:layout_marginBottom">2dp</item> + <item name="android:background">@drawable/grant_permissions_buttons_top</item> + </style> + + <style name="PermissionGrantButtonBottom" + parent="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"> + <item name="android:layout_width">332dp</item> + <item name="android:layout_height">56dp</item> + <item name="android:layout_marginTop">2dp</item> + <item name="android:layout_marginBottom">2dp</item> + <item name="android:background">@drawable/grant_permissions_buttons_bottom</item> + </style> </resources> diff --git a/core/java/com/android/internal/app/LogAccessDialogActivity.java b/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java index 4adb8673084b..a88a4ca58820 100644 --- a/core/java/com/android/internal/app/LogAccessDialogActivity.java +++ b/packages/SystemUI/src/com/android/systemui/logcat/LogAccessDialogActivity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.internal.app; +package com.android.systemui.logcat; import android.annotation.StyleRes; import android.app.Activity; @@ -23,7 +23,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -43,7 +42,9 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; -import com.android.internal.R; +import com.android.internal.app.ILogAccessDialogCallback; +import com.android.systemui.R; + /** * Dialog responsible for obtaining user consent per-use log access @@ -93,10 +94,7 @@ public class LogAccessDialogActivity extends Activity implements mAlertLearnMore = getResources().getString(R.string.log_access_confirmation_learn_more); // create View - boolean isDarkTheme = (getResources().getConfiguration().uiMode - & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; - int themeId = isDarkTheme ? android.R.style.Theme_DeviceDefault_Dialog_Alert : - android.R.style.Theme_DeviceDefault_Light_Dialog_Alert; + int themeId = R.style.LogAccessDialogTheme; mAlertView = createView(themeId); // create AlertDialog @@ -177,8 +175,7 @@ public class LogAccessDialogActivity extends Activity implements PackageManager.MATCH_DIRECT_BOOT_AUTO, UserHandle.getUserId(uid)).loadLabel(pm); - String titleString = context.getString( - com.android.internal.R.string.log_access_confirmation_title, appLabel); + String titleString = context.getString(R.string.log_access_confirmation_title, appLabel); return titleString; } @@ -235,15 +232,12 @@ public class LogAccessDialogActivity extends Activity implements @Override public void onClick(View view) { try { - switch (view.getId()) { - case R.id.log_access_dialog_allow_button: - mCallback.approveAccessForClient(mUid, mPackageName); - finish(); - break; - case R.id.log_access_dialog_deny_button: - declineLogAccess(); - finish(); - break; + if (view.getId() == R.id.log_access_dialog_allow_button) { + mCallback.approveAccessForClient(mUid, mPackageName); + finish(); + } else if (view.getId() == R.id.log_access_dialog_allow_button) { + declineLogAccess(); + finish(); } } catch (RemoteException e) { finish(); diff --git a/packages/SystemUI/src/com/android/systemui/logcat/OWNERS b/packages/SystemUI/src/com/android/systemui/logcat/OWNERS new file mode 100644 index 000000000000..9c0c414011a1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/logcat/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 1218649 +file:platform/frameworks/base:/services/core/java/com/android/server/logcat/OWNERS
\ No newline at end of file diff --git a/services/core/java/com/android/server/logcat/LogcatManagerService.java b/services/core/java/com/android/server/logcat/LogcatManagerService.java index fdc5bab7c6eb..497ed0346d97 100644 --- a/services/core/java/com/android/server/logcat/LogcatManagerService.java +++ b/services/core/java/com/android/server/logcat/LogcatManagerService.java @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -41,7 +42,6 @@ import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.ILogAccessDialogCallback; -import com.android.internal.app.LogAccessDialogActivity; import com.android.internal.util.ArrayUtils; import com.android.server.LocalServices; import com.android.server.SystemService; @@ -62,6 +62,10 @@ import java.util.function.Supplier; public final class LogcatManagerService extends SystemService { private static final String TAG = "LogcatManagerService"; private static final boolean DEBUG = false; + private static final String TARGET_PACKAGE_NAME = "com.android.systemui"; + private static final String TARGET_ACTIVITY_NAME = + "com.android.systemui.logcat.LogAccessDialogActivity"; + public static final String EXTRA_CALLBACK = "EXTRA_CALLBACK"; /** How long to wait for the user to approve/decline before declining automatically */ @VisibleForTesting @@ -442,6 +446,7 @@ public final class LogcatManagerService extends SystemService { mClock.get() + PENDING_CONFIRMATION_TIMEOUT_MILLIS); final Intent mIntent = createIntent(client); mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mIntent.setComponent(new ComponentName(TARGET_PACKAGE_NAME, TARGET_ACTIVITY_NAME)); mContext.startActivityAsUser(mIntent, UserHandle.SYSTEM); } @@ -536,13 +541,13 @@ public final class LogcatManagerService extends SystemService { * Create the Intent for LogAccessDialogActivity. */ public Intent createIntent(LogAccessClient client) { - final Intent intent = new Intent(mContext, LogAccessDialogActivity.class); + final Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, client.mPackageName); intent.putExtra(Intent.EXTRA_UID, client.mUid); - intent.putExtra(LogAccessDialogActivity.EXTRA_CALLBACK, mDialogCallback.asBinder()); + intent.putExtra(EXTRA_CALLBACK, mDialogCallback.asBinder()); return intent; } |