Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −4 Original line number Diff line number Diff line Loading @@ -569,10 +569,6 @@ object Flags { val TRACKPAD_GESTURE_COMMON = releasedFlag(1210, "trackpad_gesture_common") // 1300 - screenshots // TODO(b/254513155): Tracking Bug @JvmField val SCREENSHOT_WORK_PROFILE_POLICY = releasedFlag(1301, "screenshot_work_profile_policy") // TODO(b/264916608): Tracking Bug @JvmField val SCREENSHOT_METADATA = unreleasedFlag(1302, "screenshot_metadata", teamfood = true) Loading packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java +1 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import androidx.exifinterface.media.ExifInterface; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.google.common.util.concurrent.ListenableFuture; Loading Loading @@ -294,8 +293,7 @@ public class ImageExporter { final ContentValues values = createMetadata(time, format, fileName); Uri baseUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; if (flags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) && UserHandle.myUserId() != owner.getIdentifier()) { if (UserHandle.myUserId() != owner.getIdentifier()) { baseUri = ContentProvider.maybeAddUserId(baseUri, owner.getIdentifier()); } Uri uri = resolver.insert(baseUri, values); Loading packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java +5 −20 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.screenshot.ScrollCaptureController.LongScreenshot; import com.android.systemui.settings.UserTracker; Loading Loading @@ -335,8 +334,7 @@ public class LongScreenshotActivity extends Activity { } private void doEdit(Uri uri) { if (mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) && mScreenshotUserHandle != Process.myUserHandle()) { if (mScreenshotUserHandle != Process.myUserHandle()) { // TODO: Fix transition for work profile. Omitting it in the meantime. mActionExecutor.launchIntentAsync( ActionIntentCreator.INSTANCE.createEditIntent(uri, this), Loading Loading @@ -365,21 +363,9 @@ public class LongScreenshotActivity extends Activity { } private void doShare(Uri uri) { if (mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { Intent shareIntent = ActionIntentCreator.INSTANCE.createShareIntent(uri); mActionExecutor.launchIntentAsync(shareIntent, null, mScreenshotUserHandle.getIdentifier(), false); } else { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/png"); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION); Intent sharingChooserIntent = Intent.createChooser(intent, null) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); startActivityAsUser(sharingChooserIntent, mUserTracker.getUserHandle()); } } private void onClicked(View v) { Loading Loading @@ -421,8 +407,7 @@ public class LongScreenshotActivity extends Activity { mOutputBitmap = renderBitmap(drawable, bounds); ListenableFuture<ImageExporter.Result> exportFuture = mImageExporter.export( mBackgroundExecutor, UUID.randomUUID(), mOutputBitmap, ZonedDateTime.now(), mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) ? mScreenshotUserHandle : Process.myUserHandle()); mScreenshotUserHandle); exportFuture.addListener(() -> onExportCompleted(action, exportFuture), mUiExecutor); } Loading packages/SystemUI/src/com/android/systemui/screenshot/MessageContainerController.kt +31 −36 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ constructor( // Minimal implementation for use when Flags.SCREENSHOT_METADATA isn't turned on. fun onScreenshotTaken(userHandle: UserHandle) { if (featureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { val workProfileData = workProfileMessageController.onScreenshotTaken(userHandle) if (workProfileData != null) { workProfileFirstRunView.visibility = View.VISIBLE Loading @@ -61,12 +60,9 @@ constructor( animateInMessageContainer() } } } fun onScreenshotTaken(screenshot: ScreenshotData) { if (featureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = listOf() if (featureFlags.isEnabled(Flags.SCREENSHOT_DETECTION)) { notifiedApps = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) Loading @@ -90,7 +86,6 @@ constructor( animateInMessageContainer() } } } private fun animateInMessageContainer() { if (container.visibility == View.VISIBLE) return Loading packages/SystemUI/src/com/android/systemui/screenshot/RequestProcessor.kt +2 −7 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.internal.util.ScreenshotRequest import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags.SCREENSHOT_WORK_PROFILE_POLICY import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import java.util.function.Consumer Loading Loading @@ -57,9 +56,7 @@ class RequestProcessor @Inject constructor( // Whenever displayContentInfo is fetched, the topComponent is also populated // regardless of the managed profile status. if (request.type != TAKE_SCREENSHOT_PROVIDED_IMAGE && flags.isEnabled(SCREENSHOT_WORK_PROFILE_POLICY) ) { if (request.type != TAKE_SCREENSHOT_PROVIDED_IMAGE) { val info = policy.findPrimaryContent(policy.getDefaultDisplayId()) Log.d(TAG, "findPrimaryContent: $info") Loading Loading @@ -118,9 +115,7 @@ class RequestProcessor @Inject constructor( // Whenever displayContentInfo is fetched, the topComponent is also populated // regardless of the managed profile status. if (screenshot.type != TAKE_SCREENSHOT_PROVIDED_IMAGE && flags.isEnabled(SCREENSHOT_WORK_PROFILE_POLICY) ) { if (screenshot.type != TAKE_SCREENSHOT_PROVIDED_IMAGE) { val info = policy.findPrimaryContent(policy.getDefaultDisplayId()) Log.d(TAG, "findPrimaryContent: $info") result.taskId = info.taskId Loading Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −4 Original line number Diff line number Diff line Loading @@ -569,10 +569,6 @@ object Flags { val TRACKPAD_GESTURE_COMMON = releasedFlag(1210, "trackpad_gesture_common") // 1300 - screenshots // TODO(b/254513155): Tracking Bug @JvmField val SCREENSHOT_WORK_PROFILE_POLICY = releasedFlag(1301, "screenshot_work_profile_policy") // TODO(b/264916608): Tracking Bug @JvmField val SCREENSHOT_METADATA = unreleasedFlag(1302, "screenshot_metadata", teamfood = true) Loading
packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java +1 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import androidx.exifinterface.media.ExifInterface; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.google.common.util.concurrent.ListenableFuture; Loading Loading @@ -294,8 +293,7 @@ public class ImageExporter { final ContentValues values = createMetadata(time, format, fileName); Uri baseUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; if (flags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) && UserHandle.myUserId() != owner.getIdentifier()) { if (UserHandle.myUserId() != owner.getIdentifier()) { baseUri = ContentProvider.maybeAddUserId(baseUri, owner.getIdentifier()); } Uri uri = resolver.insert(baseUri, values); Loading
packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java +5 −20 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.screenshot.ScrollCaptureController.LongScreenshot; import com.android.systemui.settings.UserTracker; Loading Loading @@ -335,8 +334,7 @@ public class LongScreenshotActivity extends Activity { } private void doEdit(Uri uri) { if (mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) && mScreenshotUserHandle != Process.myUserHandle()) { if (mScreenshotUserHandle != Process.myUserHandle()) { // TODO: Fix transition for work profile. Omitting it in the meantime. mActionExecutor.launchIntentAsync( ActionIntentCreator.INSTANCE.createEditIntent(uri, this), Loading Loading @@ -365,21 +363,9 @@ public class LongScreenshotActivity extends Activity { } private void doShare(Uri uri) { if (mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { Intent shareIntent = ActionIntentCreator.INSTANCE.createShareIntent(uri); mActionExecutor.launchIntentAsync(shareIntent, null, mScreenshotUserHandle.getIdentifier(), false); } else { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/png"); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION); Intent sharingChooserIntent = Intent.createChooser(intent, null) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); startActivityAsUser(sharingChooserIntent, mUserTracker.getUserHandle()); } } private void onClicked(View v) { Loading Loading @@ -421,8 +407,7 @@ public class LongScreenshotActivity extends Activity { mOutputBitmap = renderBitmap(drawable, bounds); ListenableFuture<ImageExporter.Result> exportFuture = mImageExporter.export( mBackgroundExecutor, UUID.randomUUID(), mOutputBitmap, ZonedDateTime.now(), mFeatureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY) ? mScreenshotUserHandle : Process.myUserHandle()); mScreenshotUserHandle); exportFuture.addListener(() -> onExportCompleted(action, exportFuture), mUiExecutor); } Loading
packages/SystemUI/src/com/android/systemui/screenshot/MessageContainerController.kt +31 −36 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ constructor( // Minimal implementation for use when Flags.SCREENSHOT_METADATA isn't turned on. fun onScreenshotTaken(userHandle: UserHandle) { if (featureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { val workProfileData = workProfileMessageController.onScreenshotTaken(userHandle) if (workProfileData != null) { workProfileFirstRunView.visibility = View.VISIBLE Loading @@ -61,12 +60,9 @@ constructor( animateInMessageContainer() } } } fun onScreenshotTaken(screenshot: ScreenshotData) { if (featureFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) { val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) val workProfileData = workProfileMessageController.onScreenshotTaken(screenshot.userHandle) var notifiedApps: List<CharSequence> = listOf() if (featureFlags.isEnabled(Flags.SCREENSHOT_DETECTION)) { notifiedApps = screenshotDetectionController.maybeNotifyOfScreenshot(screenshot) Loading @@ -90,7 +86,6 @@ constructor( animateInMessageContainer() } } } private fun animateInMessageContainer() { if (container.visibility == View.VISIBLE) return Loading
packages/SystemUI/src/com/android/systemui/screenshot/RequestProcessor.kt +2 −7 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.internal.util.ScreenshotRequest import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags.SCREENSHOT_WORK_PROFILE_POLICY import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import java.util.function.Consumer Loading Loading @@ -57,9 +56,7 @@ class RequestProcessor @Inject constructor( // Whenever displayContentInfo is fetched, the topComponent is also populated // regardless of the managed profile status. if (request.type != TAKE_SCREENSHOT_PROVIDED_IMAGE && flags.isEnabled(SCREENSHOT_WORK_PROFILE_POLICY) ) { if (request.type != TAKE_SCREENSHOT_PROVIDED_IMAGE) { val info = policy.findPrimaryContent(policy.getDefaultDisplayId()) Log.d(TAG, "findPrimaryContent: $info") Loading Loading @@ -118,9 +115,7 @@ class RequestProcessor @Inject constructor( // Whenever displayContentInfo is fetched, the topComponent is also populated // regardless of the managed profile status. if (screenshot.type != TAKE_SCREENSHOT_PROVIDED_IMAGE && flags.isEnabled(SCREENSHOT_WORK_PROFILE_POLICY) ) { if (screenshot.type != TAKE_SCREENSHOT_PROVIDED_IMAGE) { val info = policy.findPrimaryContent(policy.getDefaultDisplayId()) Log.d(TAG, "findPrimaryContent: $info") result.taskId = info.taskId Loading