Merge "Adds a notification to work profile screenshots" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5f3f88b058
@@ -44,7 +44,7 @@
|
|||||||
app:layout_constraintHorizontal_bias="0"
|
app:layout_constraintHorizontal_bias="0"
|
||||||
app:layout_constraintWidth_percent="1.0"
|
app:layout_constraintWidth_percent="1.0"
|
||||||
app:layout_constraintWidth_max="wrap"
|
app:layout_constraintWidth_max="wrap"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@id/screenshot_message_container"
|
||||||
app:layout_constraintStart_toEndOf="@+id/screenshot_preview_border"
|
app:layout_constraintStart_toEndOf="@+id/screenshot_preview_border"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
android:background="@drawable/overlay_border"
|
android:background="@drawable/overlay_border"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@id/screenshot_message_container"
|
||||||
app:layout_constraintEnd_toEndOf="@id/screenshot_preview_end"
|
app:layout_constraintEnd_toEndOf="@id/screenshot_preview_end"
|
||||||
app:layout_constraintTop_toTopOf="@id/screenshot_preview_top"/>
|
app:layout_constraintTop_toTopOf="@id/screenshot_preview_top"/>
|
||||||
<androidx.constraintlayout.widget.Barrier
|
<androidx.constraintlayout.widget.Barrier
|
||||||
@@ -142,4 +142,41 @@
|
|||||||
app:layout_constraintStart_toStartOf="@id/screenshot_preview"
|
app:layout_constraintStart_toStartOf="@id/screenshot_preview"
|
||||||
app:layout_constraintTop_toTopOf="@id/screenshot_preview"
|
app:layout_constraintTop_toTopOf="@id/screenshot_preview"
|
||||||
android:elevation="7dp"/>
|
android:elevation="7dp"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/screenshot_message_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="@dimen/overlay_action_container_margin_horizontal"
|
||||||
|
android:layout_marginVertical="4dp"
|
||||||
|
android:paddingHorizontal="@dimen/overlay_action_container_padding_right"
|
||||||
|
android:paddingVertical="@dimen/overlay_action_container_padding_vertical"
|
||||||
|
android:elevation="4dp"
|
||||||
|
android:background="@drawable/action_chip_container_background"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/screenshot_message_icon"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:paddingEnd="4dp"
|
||||||
|
android:src="@drawable/ic_work_app_badge"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/screenshot_message_content"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/screenshot_message_icon"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</com.android.systemui.screenshot.DraggableConstraintLayout>
|
</com.android.systemui.screenshot.DraggableConstraintLayout>
|
||||||
|
|||||||
@@ -235,6 +235,8 @@
|
|||||||
<string name="screenshot_left_boundary_pct">Left boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string>
|
<string name="screenshot_left_boundary_pct">Left boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string>
|
||||||
<!-- Content description for the right boundary of the screenshot being cropped, with the current position as a percentage. [CHAR LIMIT=NONE] -->
|
<!-- Content description for the right boundary of the screenshot being cropped, with the current position as a percentage. [CHAR LIMIT=NONE] -->
|
||||||
<string name="screenshot_right_boundary_pct">Right boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string>
|
<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" translatable="false">Work screenshots are saved in the work <xliff:g id="app" example="Files">%1$s</xliff:g> app</string>
|
||||||
|
|
||||||
<!-- Notification title displayed for screen recording [CHAR LIMIT=50]-->
|
<!-- Notification title displayed for screen recording [CHAR LIMIT=50]-->
|
||||||
<string name="screenrecord_name">Screen Recorder</string>
|
<string name="screenrecord_name">Screen Recorder</string>
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -276,6 +277,7 @@ public class ScreenshotController {
|
|||||||
mScreenshotNotificationSmartActionsProvider;
|
mScreenshotNotificationSmartActionsProvider;
|
||||||
private final TimeoutHandler mScreenshotHandler;
|
private final TimeoutHandler mScreenshotHandler;
|
||||||
private final ActionIntentExecutor mActionExecutor;
|
private final ActionIntentExecutor mActionExecutor;
|
||||||
|
private final UserManager mUserManager;
|
||||||
|
|
||||||
private ScreenshotView mScreenshotView;
|
private ScreenshotView mScreenshotView;
|
||||||
private Bitmap mScreenBitmap;
|
private Bitmap mScreenBitmap;
|
||||||
@@ -314,7 +316,8 @@ public class ScreenshotController {
|
|||||||
TimeoutHandler timeoutHandler,
|
TimeoutHandler timeoutHandler,
|
||||||
BroadcastSender broadcastSender,
|
BroadcastSender broadcastSender,
|
||||||
ScreenshotNotificationSmartActionsProvider screenshotNotificationSmartActionsProvider,
|
ScreenshotNotificationSmartActionsProvider screenshotNotificationSmartActionsProvider,
|
||||||
ActionIntentExecutor actionExecutor
|
ActionIntentExecutor actionExecutor,
|
||||||
|
UserManager userManager
|
||||||
) {
|
) {
|
||||||
mScreenshotSmartActions = screenshotSmartActions;
|
mScreenshotSmartActions = screenshotSmartActions;
|
||||||
mNotificationsController = screenshotNotificationsController;
|
mNotificationsController = screenshotNotificationsController;
|
||||||
@@ -345,6 +348,7 @@ public class ScreenshotController {
|
|||||||
mWindowManager = mContext.getSystemService(WindowManager.class);
|
mWindowManager = mContext.getSystemService(WindowManager.class);
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
mActionExecutor = actionExecutor;
|
mActionExecutor = actionExecutor;
|
||||||
|
mUserManager = userManager;
|
||||||
|
|
||||||
mAccessibilityManager = AccessibilityManager.getInstance(mContext);
|
mAccessibilityManager = AccessibilityManager.getInstance(mContext);
|
||||||
|
|
||||||
@@ -975,16 +979,25 @@ public class ScreenshotController {
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
super.onAnimationEnd(animation);
|
super.onAnimationEnd(animation);
|
||||||
mScreenshotView.setChipIntents(imageData);
|
doPostAnimation(imageData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
mScreenshotView.setChipIntents(imageData);
|
doPostAnimation(imageData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doPostAnimation(ScreenshotController.SavedImageData imageData) {
|
||||||
|
mScreenshotView.setChipIntents(imageData);
|
||||||
|
if (mFlags.isEnabled(SCREENSHOT_WORK_PROFILE_POLICY)
|
||||||
|
&& mUserManager.isManagedProfile(imageData.owner.getIdentifier())) {
|
||||||
|
// TODO: Read app from configuration
|
||||||
|
mScreenshotView.showWorkProfileMessage("Files");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the action shade and its entrance animation, once we get the Quick Share action data.
|
* Sets up the action shade and its entrance animation, once we get the Quick Share action data.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import android.widget.FrameLayout;
|
|||||||
import android.widget.HorizontalScrollView;
|
import android.widget.HorizontalScrollView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
@@ -137,6 +138,8 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
|
|
||||||
private ImageView mScrollingScrim;
|
private ImageView mScrollingScrim;
|
||||||
private DraggableConstraintLayout mScreenshotStatic;
|
private DraggableConstraintLayout mScreenshotStatic;
|
||||||
|
private ViewGroup mMessageContainer;
|
||||||
|
private TextView mMessageContent;
|
||||||
private ImageView mScreenshotPreview;
|
private ImageView mScreenshotPreview;
|
||||||
private ImageView mScreenshotBadge;
|
private ImageView mScreenshotBadge;
|
||||||
private View mScreenshotPreviewBorder;
|
private View mScreenshotPreviewBorder;
|
||||||
@@ -340,10 +343,26 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a notification under the screenshot view indicating that a work profile screenshot has
|
||||||
|
* been taken and which app can be used to view it.
|
||||||
|
*
|
||||||
|
* @param appName The name of the app to use to view screenshots
|
||||||
|
*/
|
||||||
|
void showWorkProfileMessage(String appName) {
|
||||||
|
mMessageContent.setText(
|
||||||
|
mContext.getString(R.string.screenshot_work_profile_notification, appName));
|
||||||
|
mMessageContainer.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override // View
|
@Override // View
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
mScrollingScrim = requireNonNull(findViewById(R.id.screenshot_scrolling_scrim));
|
mScrollingScrim = requireNonNull(findViewById(R.id.screenshot_scrolling_scrim));
|
||||||
mScreenshotStatic = requireNonNull(findViewById(R.id.screenshot_static));
|
mScreenshotStatic = requireNonNull(findViewById(R.id.screenshot_static));
|
||||||
|
mMessageContainer =
|
||||||
|
requireNonNull(mScreenshotStatic.findViewById(R.id.screenshot_message_container));
|
||||||
|
mMessageContent =
|
||||||
|
requireNonNull(mMessageContainer.findViewById(R.id.screenshot_message_content));
|
||||||
mScreenshotPreview = requireNonNull(findViewById(R.id.screenshot_preview));
|
mScreenshotPreview = requireNonNull(findViewById(R.id.screenshot_preview));
|
||||||
|
|
||||||
mScreenshotPreviewBorder = requireNonNull(
|
mScreenshotPreviewBorder = requireNonNull(
|
||||||
|
|||||||
Reference in New Issue
Block a user