Merge "Update toast strings for blocking camera to match UX guideline" into tm-dev
This commit is contained in:
@@ -6279,7 +6279,9 @@ ul.</string>
|
||||
|
||||
<!-- Strings for VirtualDeviceManager -->
|
||||
<!-- Error message indicating the camera cannot be accessed when running on a virtual device. [CHAR LIMIT=NONE] -->
|
||||
<string name="vdm_camera_access_denied">Cannot access camera from this device</string>
|
||||
<string name="vdm_camera_access_denied" product="default">Can’t access the phone’s camera from your <xliff:g id="device" example="Chromebook">%1$s</xliff:g></string>
|
||||
<!-- Error message indicating the camera cannot be accessed when running on a virtual device. [CHAR LIMIT=NONE] -->
|
||||
<string name="vdm_camera_access_denied" product="tablet">Can’t access the tablet’s camera from your <xliff:g id="device" example="Chromebook">%1$s</xliff:g></string>
|
||||
|
||||
<!-- Title for preference of the system default locale. [CHAR LIMIT=50]-->
|
||||
<string name="system_locale_title">System language</string>
|
||||
|
||||
@@ -173,6 +173,11 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
|
||||
return flags;
|
||||
}
|
||||
|
||||
/** Returns the device display name. */
|
||||
CharSequence getDisplayName() {
|
||||
return mAssociationInfo.getDisplayName();
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public int getAssociationId() {
|
||||
return mAssociationInfo.getId();
|
||||
@@ -595,6 +600,13 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
|
||||
* Shows a toast on virtual displays owned by this device which have a given uid running.
|
||||
*/
|
||||
void showToastWhereUidIsRunning(int uid, @StringRes int resId, @Toast.Duration int duration) {
|
||||
showToastWhereUidIsRunning(uid, mContext.getString(resId), duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a toast on virtual displays owned by this device which have a given uid running.
|
||||
*/
|
||||
void showToastWhereUidIsRunning(int uid, String text, @Toast.Duration int duration) {
|
||||
synchronized (mVirtualDeviceLock) {
|
||||
DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
|
||||
final int size = mWindowPolicyControllers.size();
|
||||
@@ -603,7 +615,7 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
|
||||
int displayId = mWindowPolicyControllers.keyAt(i);
|
||||
Display display = displayManager.getDisplay(displayId);
|
||||
if (display != null && display.isValid()) {
|
||||
Toast.makeText(mContext.createDisplayContext(display), resId,
|
||||
Toast.makeText(mContext.createDisplayContext(display), text,
|
||||
duration).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,8 +193,12 @@ public class VirtualDeviceManagerService extends SystemService {
|
||||
synchronized (mVirtualDeviceManagerLock) {
|
||||
int size = mVirtualDevices.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
CharSequence deviceName = mVirtualDevices.valueAt(i).getDisplayName();
|
||||
mVirtualDevices.valueAt(i).showToastWhereUidIsRunning(appUid,
|
||||
com.android.internal.R.string.vdm_camera_access_denied, Toast.LENGTH_LONG);
|
||||
getContext().getString(
|
||||
com.android.internal.R.string.vdm_camera_access_denied,
|
||||
deviceName),
|
||||
Toast.LENGTH_LONG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user