Loading packages/SystemUI/AndroidManifest.xml +14 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,20 @@ android:excludeFromRecents="true" android:exported="true" /> <!-- started from Telecomm(CallsManager) --> <activity android:name=".telephony.ui.activity.SwitchToManagedProfileForCallActivity" android:excludeFromRecents="true" android:exported="true" android:finishOnCloseSystemDialogs="true" android:permission="android.permission.MODIFY_PHONE_STATE" android:theme="@style/Theme.SystemUI.Dialog.Alert"> <intent-filter> <action android:name="android.telecom.action.SHOW_SWITCH_TO_WORK_PROFILE_FOR_CALL_DIALOG" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <!-- platform logo easter egg activity --> <activity android:name=".DessertCase" Loading packages/SystemUI/res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -2777,4 +2777,19 @@ <string name="stylus_battery_low_percentage"><xliff:g id="percentage" example="16%">%s</xliff:g> battery remaining</string> <!-- Subtitle for the notification sent when a stylus battery is low. [CHAR LIMIT=none]--> <string name="stylus_battery_low_subtitle">Connect your stylus to a charger</string> <!-- Switch to work profile dialer app for placing a call dialog. --> <!-- Text for Switch to work profile dialog's Title. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy. [CHAR LIMIT=60] --> <string name="call_from_work_profile_title">Can\'t call from this profile</string> <!-- Text for switch to work profile for call dialog to guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy. [CHAR LIMIT=NONE] --> <string name="call_from_work_profile_text">Your work policy allows you to make phone calls only from the work profile</string> <!-- Label for the button to switch to work profile for placing call. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy.[CHAR LIMIT=60] --> <string name="call_from_work_profile_action">Switch to work profile</string> <!-- Label for the close button on switch to work profile dialog. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy.[CHAR LIMIT=60] --> <string name="call_from_work_profile_close">Close</string> </resources> packages/SystemUI/src/com/android/systemui/telephony/ui/activity/SwitchToManagedProfileForCallActivity.kt 0 → 100644 +81 −0 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.systemui.telephony.ui.activity import android.app.ActivityOptions import android.content.DialogInterface import android.content.Intent import android.net.Uri import android.os.Bundle import android.os.UserHandle import android.util.Log import android.view.WindowManager import com.android.internal.app.AlertActivity import com.android.systemui.R /** Dialog shown to the user to switch to managed profile for making a call using work SIM. */ class SwitchToManagedProfileForCallActivity : AlertActivity(), DialogInterface.OnClickListener { private lateinit var phoneNumber: Uri private var managedProfileUserId = UserHandle.USER_NULL override fun onCreate(savedInstanceState: Bundle?) { window.addSystemFlags( WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS ) super.onCreate(savedInstanceState) phoneNumber = intent.getData() managedProfileUserId = intent.getIntExtra( "android.telecom.extra.MANAGED_PROFILE_USER_ID", UserHandle.USER_NULL ) mAlertParams.apply { mTitle = getString(R.string.call_from_work_profile_title) mMessage = getString(R.string.call_from_work_profile_text) mPositiveButtonText = getString(R.string.call_from_work_profile_action) mNegativeButtonText = getString(R.string.call_from_work_profile_close) mPositiveButtonListener = this@SwitchToManagedProfileForCallActivity mNegativeButtonListener = this@SwitchToManagedProfileForCallActivity } setupAlert() } override fun onClick(dialog: DialogInterface?, which: Int) { if (which == BUTTON_POSITIVE) { switchToManagedProfile() } finish() } private fun switchToManagedProfile() { try { applicationContext.startActivityAsUser( Intent(Intent.ACTION_DIAL, phoneNumber), ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), UserHandle.of(managedProfileUserId) ) } catch (e: Exception) { Log.e(TAG, "Failed to launch activity", e) } } companion object { private const val TAG = "SwitchToManagedProfileForCallActivity" } } Loading
packages/SystemUI/AndroidManifest.xml +14 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,20 @@ android:excludeFromRecents="true" android:exported="true" /> <!-- started from Telecomm(CallsManager) --> <activity android:name=".telephony.ui.activity.SwitchToManagedProfileForCallActivity" android:excludeFromRecents="true" android:exported="true" android:finishOnCloseSystemDialogs="true" android:permission="android.permission.MODIFY_PHONE_STATE" android:theme="@style/Theme.SystemUI.Dialog.Alert"> <intent-filter> <action android:name="android.telecom.action.SHOW_SWITCH_TO_WORK_PROFILE_FOR_CALL_DIALOG" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <!-- platform logo easter egg activity --> <activity android:name=".DessertCase" Loading
packages/SystemUI/res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -2777,4 +2777,19 @@ <string name="stylus_battery_low_percentage"><xliff:g id="percentage" example="16%">%s</xliff:g> battery remaining</string> <!-- Subtitle for the notification sent when a stylus battery is low. [CHAR LIMIT=none]--> <string name="stylus_battery_low_subtitle">Connect your stylus to a charger</string> <!-- Switch to work profile dialer app for placing a call dialog. --> <!-- Text for Switch to work profile dialog's Title. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy. [CHAR LIMIT=60] --> <string name="call_from_work_profile_title">Can\'t call from this profile</string> <!-- Text for switch to work profile for call dialog to guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy. [CHAR LIMIT=NONE] --> <string name="call_from_work_profile_text">Your work policy allows you to make phone calls only from the work profile</string> <!-- Label for the button to switch to work profile for placing call. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy.[CHAR LIMIT=60] --> <string name="call_from_work_profile_action">Switch to work profile</string> <!-- Label for the close button on switch to work profile dialog. Switch to work profile dialog guide users to make call from work profile dialer app as it's not possible to make call from current profile due to an admin policy.[CHAR LIMIT=60] --> <string name="call_from_work_profile_close">Close</string> </resources>
packages/SystemUI/src/com/android/systemui/telephony/ui/activity/SwitchToManagedProfileForCallActivity.kt 0 → 100644 +81 −0 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.systemui.telephony.ui.activity import android.app.ActivityOptions import android.content.DialogInterface import android.content.Intent import android.net.Uri import android.os.Bundle import android.os.UserHandle import android.util.Log import android.view.WindowManager import com.android.internal.app.AlertActivity import com.android.systemui.R /** Dialog shown to the user to switch to managed profile for making a call using work SIM. */ class SwitchToManagedProfileForCallActivity : AlertActivity(), DialogInterface.OnClickListener { private lateinit var phoneNumber: Uri private var managedProfileUserId = UserHandle.USER_NULL override fun onCreate(savedInstanceState: Bundle?) { window.addSystemFlags( WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS ) super.onCreate(savedInstanceState) phoneNumber = intent.getData() managedProfileUserId = intent.getIntExtra( "android.telecom.extra.MANAGED_PROFILE_USER_ID", UserHandle.USER_NULL ) mAlertParams.apply { mTitle = getString(R.string.call_from_work_profile_title) mMessage = getString(R.string.call_from_work_profile_text) mPositiveButtonText = getString(R.string.call_from_work_profile_action) mNegativeButtonText = getString(R.string.call_from_work_profile_close) mPositiveButtonListener = this@SwitchToManagedProfileForCallActivity mNegativeButtonListener = this@SwitchToManagedProfileForCallActivity } setupAlert() } override fun onClick(dialog: DialogInterface?, which: Int) { if (which == BUTTON_POSITIVE) { switchToManagedProfile() } finish() } private fun switchToManagedProfile() { try { applicationContext.startActivityAsUser( Intent(Intent.ACTION_DIAL, phoneNumber), ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), UserHandle.of(managedProfileUserId) ) } catch (e: Exception) { Log.e(TAG, "Failed to launch activity", e) } } companion object { private const val TAG = "SwitchToManagedProfileForCallActivity" } }