Loading packages/SystemUI/res/values/config.xml +5 −4 Original line number Diff line number Diff line Loading @@ -461,10 +461,11 @@ This name is in the ComponentName flattened format (package/class) --> <string name="config_screenshotEditor" translatable="false"></string> <!-- ComponentName for the file browsing app that the system would expect to be used in work profile. The icon for this app will be shown to the user when informing them that a screenshot has been saved to work profile. If blank, a default icon will be shown. --> <string name="config_sceenshotWorkProfileFilesApp" translatable="false"></string> <!-- ComponentName for the file browsing app that the system would expect to be used for screenshots. The icon for this app will be shown to the user when informing them that a screenshot has been saved to a different profile (e.g. work profile). If blank, a default icon will be shown. --> <string name="config_screenshotFilesApp" translatable="false"></string> <!-- The component name of the screenshot editing activity that provides the App Clips flow. The App Clips flow includes taking a screenshot, showing user screenshot cropping activity Loading packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,8 @@ <string name="screenshot_right_boundary_pct">Right boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string> <!-- Notification displayed when a screenshot is saved in a work profile. [CHAR LIMIT=NONE] --> <string name="screenshot_work_profile_notification">Saved in <xliff:g id="app" example="Files">%1$s</xliff:g> in the work profile</string> <!-- Notification displayed when a screenshot is saved in the private profile. [CHAR LIMIT=NONE] --> <string name="screenshot_private_profile_notification">Saved in <xliff:g id="app" example="Files">%1$s</xliff:g> in the private profile</string> <!-- Default name referring to the app on the device that lets the user browse stored files. [CHAR LIMIT=NONE] --> <string name="screenshot_default_files_app_name">Files</string> <!-- A notice shown to the user to indicate that an app has detected the screenshot that the user has just taken. [CHAR LIMIT=75] --> Loading packages/SystemUI/src/com/android/systemui/screenshot/MessageContainerController.kt +51 −36 Original line number Diff line number Diff line Loading @@ -3,15 +3,19 @@ package com.android.systemui.screenshot import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.os.UserHandle import android.view.View import android.view.ViewGroup import android.view.ViewGroup.MarginLayoutParams import android.view.ViewTreeObserver import android.view.animation.AccelerateDecelerateInterpolator import androidx.constraintlayout.widget.Guideline import com.android.systemui.Flags.screenshotPrivateProfileBehaviorFix import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.res.R import com.android.systemui.screenshot.message.ProfileMessageController import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch /** * MessageContainerController controls the display of content in the screenshot message container. Loading @@ -20,7 +24,9 @@ class MessageContainerController @Inject constructor( private val workProfileMessageController: WorkProfileMessageController, private val profileMessageController: ProfileMessageController, private val screenshotDetectionController: ScreenshotDetectionController, @Application private val mainScope: CoroutineScope, ) { private lateinit var container: ViewGroup private lateinit var guideline: Guideline Loading @@ -42,24 +48,32 @@ constructor( detectionNoticeView.visibility = View.GONE } // Minimal implementation for use when Flags.SCREENSHOT_METADATA isn't turned on. fun onScreenshotTaken(userHandle: UserHandle) { val workProfileData = workProfileMessageController.onScreenshotTaken(userHandle) if (workProfileData != null) { fun onScreenshotTaken(screenshot: ScreenshotData) { if (screenshotPrivateProfileBehaviorFix()) { mainScope.launch { val profileData = profileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) // If profile first run needs to show, bias towards that, otherwise show screenshot // detection notification if needed. if (profileData != null) { workProfileFirstRunView.visibility = View.VISIBLE detectionNoticeView.visibility = View.GONE workProfileMessageController.populateView( workProfileFirstRunView, workProfileData, this::animateOutMessageContainer ) profileMessageController.bindView(workProfileFirstRunView, profileData) { animateOutMessageContainer() } animateInMessageContainer() } else if (notifiedApps.isNotEmpty()) { detectionNoticeView.visibility = View.VISIBLE workProfileFirstRunView.visibility = View.GONE screenshotDetectionController.populateView(detectionNoticeView, notifiedApps) animateInMessageContainer() } } fun onScreenshotTaken(screenshot: ScreenshotData) { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) } else { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) Loading @@ -81,6 +95,7 @@ constructor( animateInMessageContainer() } } } private fun animateInMessageContainer() { if (container.visibility == View.VISIBLE) return Loading packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt +4 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ constructor( if (userManager.isManagedProfile(userHandle.identifier) && !messageAlreadyDismissed()) { var badgedIcon: Drawable? = null var label: CharSequence? = null val fileManager = fileManagerComponentName() val fileManager = fileManagerComponentName() ?: return WorkProfileFirstRunData(defaultFileAppName(), null) try { val info = packageManager.getActivityInfo(fileManager, ComponentInfoFlags.of(0L)) Loading Loading @@ -103,9 +104,7 @@ constructor( context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) private fun fileManagerComponentName() = ComponentName.unflattenFromString( context.getString(R.string.config_sceenshotWorkProfileFilesApp) ) ComponentName.unflattenFromString(context.getString(R.string.config_screenshotFilesApp)) private fun defaultFileAppName() = context.getString(R.string.screenshot_default_files_app_name) Loading packages/SystemUI/src/com/android/systemui/screenshot/dagger/ScreenshotModule.java +2 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.screenshot.TakeScreenshotExecutorImpl; import com.android.systemui.screenshot.TakeScreenshotService; import com.android.systemui.screenshot.appclips.AppClipsScreenshotHelperService; import com.android.systemui.screenshot.appclips.AppClipsService; import com.android.systemui.screenshot.message.MessageModule; import com.android.systemui.screenshot.policy.ScreenshotPolicyModule; import com.android.systemui.screenshot.proxy.SystemUiProxyModule; import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel; Loading @@ -51,7 +52,7 @@ import dagger.multibindings.IntoMap; /** * Defines injectable resources for Screenshots */ @Module(includes = {ScreenshotPolicyModule.class, SystemUiProxyModule.class}) @Module(includes = {ScreenshotPolicyModule.class, SystemUiProxyModule.class, MessageModule.class}) public abstract class ScreenshotModule { @Binds Loading Loading
packages/SystemUI/res/values/config.xml +5 −4 Original line number Diff line number Diff line Loading @@ -461,10 +461,11 @@ This name is in the ComponentName flattened format (package/class) --> <string name="config_screenshotEditor" translatable="false"></string> <!-- ComponentName for the file browsing app that the system would expect to be used in work profile. The icon for this app will be shown to the user when informing them that a screenshot has been saved to work profile. If blank, a default icon will be shown. --> <string name="config_sceenshotWorkProfileFilesApp" translatable="false"></string> <!-- ComponentName for the file browsing app that the system would expect to be used for screenshots. The icon for this app will be shown to the user when informing them that a screenshot has been saved to a different profile (e.g. work profile). If blank, a default icon will be shown. --> <string name="config_screenshotFilesApp" translatable="false"></string> <!-- The component name of the screenshot editing activity that provides the App Clips flow. The App Clips flow includes taking a screenshot, showing user screenshot cropping activity Loading
packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,8 @@ <string name="screenshot_right_boundary_pct">Right boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string> <!-- Notification displayed when a screenshot is saved in a work profile. [CHAR LIMIT=NONE] --> <string name="screenshot_work_profile_notification">Saved in <xliff:g id="app" example="Files">%1$s</xliff:g> in the work profile</string> <!-- Notification displayed when a screenshot is saved in the private profile. [CHAR LIMIT=NONE] --> <string name="screenshot_private_profile_notification">Saved in <xliff:g id="app" example="Files">%1$s</xliff:g> in the private profile</string> <!-- Default name referring to the app on the device that lets the user browse stored files. [CHAR LIMIT=NONE] --> <string name="screenshot_default_files_app_name">Files</string> <!-- A notice shown to the user to indicate that an app has detected the screenshot that the user has just taken. [CHAR LIMIT=75] --> Loading
packages/SystemUI/src/com/android/systemui/screenshot/MessageContainerController.kt +51 −36 Original line number Diff line number Diff line Loading @@ -3,15 +3,19 @@ package com.android.systemui.screenshot import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.os.UserHandle import android.view.View import android.view.ViewGroup import android.view.ViewGroup.MarginLayoutParams import android.view.ViewTreeObserver import android.view.animation.AccelerateDecelerateInterpolator import androidx.constraintlayout.widget.Guideline import com.android.systemui.Flags.screenshotPrivateProfileBehaviorFix import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.res.R import com.android.systemui.screenshot.message.ProfileMessageController import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch /** * MessageContainerController controls the display of content in the screenshot message container. Loading @@ -20,7 +24,9 @@ class MessageContainerController @Inject constructor( private val workProfileMessageController: WorkProfileMessageController, private val profileMessageController: ProfileMessageController, private val screenshotDetectionController: ScreenshotDetectionController, @Application private val mainScope: CoroutineScope, ) { private lateinit var container: ViewGroup private lateinit var guideline: Guideline Loading @@ -42,24 +48,32 @@ constructor( detectionNoticeView.visibility = View.GONE } // Minimal implementation for use when Flags.SCREENSHOT_METADATA isn't turned on. fun onScreenshotTaken(userHandle: UserHandle) { val workProfileData = workProfileMessageController.onScreenshotTaken(userHandle) if (workProfileData != null) { fun onScreenshotTaken(screenshot: ScreenshotData) { if (screenshotPrivateProfileBehaviorFix()) { mainScope.launch { val profileData = profileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) // If profile first run needs to show, bias towards that, otherwise show screenshot // detection notification if needed. if (profileData != null) { workProfileFirstRunView.visibility = View.VISIBLE detectionNoticeView.visibility = View.GONE workProfileMessageController.populateView( workProfileFirstRunView, workProfileData, this::animateOutMessageContainer ) profileMessageController.bindView(workProfileFirstRunView, profileData) { animateOutMessageContainer() } animateInMessageContainer() } else if (notifiedApps.isNotEmpty()) { detectionNoticeView.visibility = View.VISIBLE workProfileFirstRunView.visibility = View.GONE screenshotDetectionController.populateView(detectionNoticeView, notifiedApps) animateInMessageContainer() } } fun onScreenshotTaken(screenshot: ScreenshotData) { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) } else { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) Loading @@ -81,6 +95,7 @@ constructor( animateInMessageContainer() } } } private fun animateInMessageContainer() { if (container.visibility == View.VISIBLE) return Loading
packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt +4 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ constructor( if (userManager.isManagedProfile(userHandle.identifier) && !messageAlreadyDismissed()) { var badgedIcon: Drawable? = null var label: CharSequence? = null val fileManager = fileManagerComponentName() val fileManager = fileManagerComponentName() ?: return WorkProfileFirstRunData(defaultFileAppName(), null) try { val info = packageManager.getActivityInfo(fileManager, ComponentInfoFlags.of(0L)) Loading Loading @@ -103,9 +104,7 @@ constructor( context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) private fun fileManagerComponentName() = ComponentName.unflattenFromString( context.getString(R.string.config_sceenshotWorkProfileFilesApp) ) ComponentName.unflattenFromString(context.getString(R.string.config_screenshotFilesApp)) private fun defaultFileAppName() = context.getString(R.string.screenshot_default_files_app_name) Loading
packages/SystemUI/src/com/android/systemui/screenshot/dagger/ScreenshotModule.java +2 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.screenshot.TakeScreenshotExecutorImpl; import com.android.systemui.screenshot.TakeScreenshotService; import com.android.systemui.screenshot.appclips.AppClipsScreenshotHelperService; import com.android.systemui.screenshot.appclips.AppClipsService; import com.android.systemui.screenshot.message.MessageModule; import com.android.systemui.screenshot.policy.ScreenshotPolicyModule; import com.android.systemui.screenshot.proxy.SystemUiProxyModule; import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel; Loading @@ -51,7 +52,7 @@ import dagger.multibindings.IntoMap; /** * Defines injectable resources for Screenshots */ @Module(includes = {ScreenshotPolicyModule.class, SystemUiProxyModule.class}) @Module(includes = {ScreenshotPolicyModule.class, SystemUiProxyModule.class, MessageModule.class}) public abstract class ScreenshotModule { @Binds Loading