* commit 'a20f625cc1006b03d4a2be90ba35d1a9783ad363': Finalize assets for screen casting.
Before Width: | Height: | Size: 549 B After Width: | Height: | Size: 539 B |
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 566 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 553 B |
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 590 B After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 566 B |
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 576 B |
BIN
core/res/res/drawable-hdpi/ic_notification_cast_0.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
core/res/res/drawable-hdpi/ic_notification_cast_1.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
core/res/res/drawable-hdpi/ic_notification_cast_2.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
core/res/res/drawable-hdpi/ic_notification_cast_on.png
Normal file
After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 417 B After Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 398 B |
BIN
core/res/res/drawable-mdpi/ic_notification_cast_0.png
Normal file
After Width: | Height: | Size: 332 B |
BIN
core/res/res/drawable-mdpi/ic_notification_cast_1.png
Normal file
After Width: | Height: | Size: 329 B |
BIN
core/res/res/drawable-mdpi/ic_notification_cast_2.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
core/res/res/drawable-mdpi/ic_notification_cast_on.png
Normal file
After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 745 B After Width: | Height: | Size: 737 B |
Before Width: | Height: | Size: 807 B After Width: | Height: | Size: 730 B |
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 738 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 804 B After Width: | Height: | Size: 731 B |
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 746 B After Width: | Height: | Size: 750 B |
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 743 B |
BIN
core/res/res/drawable-xhdpi/ic_notification_cast_0.png
Normal file
After Width: | Height: | Size: 557 B |
BIN
core/res/res/drawable-xhdpi/ic_notification_cast_1.png
Normal file
After Width: | Height: | Size: 585 B |
BIN
core/res/res/drawable-xhdpi/ic_notification_cast_2.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
core/res/res/drawable-xhdpi/ic_notification_cast_on.png
Normal file
After Width: | Height: | Size: 555 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_notification_cast_0.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
core/res/res/drawable-xxhdpi/ic_notification_cast_1.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
core/res/res/drawable-xxhdpi/ic_notification_cast_2.png
Normal file
After Width: | Height: | Size: 827 B |
BIN
core/res/res/drawable-xxhdpi/ic_notification_cast_on.png
Normal file
After Width: | Height: | Size: 768 B |
26
core/res/res/drawable/ic_notification_cast_connecting.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2013, 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.
|
||||
*/
|
||||
-->
|
||||
<animation-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<item android:drawable="@drawable/ic_notification_cast_0" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_notification_cast_1" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_notification_cast_2" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_notification_cast_1" android:duration="500" />
|
||||
</animation-list>
|
@ -4143,10 +4143,14 @@
|
||||
<!-- Title text to append when the display is secure. [CHAR LIMIT=30] -->
|
||||
<string name="display_manager_overlay_display_secure_suffix">, secure</string>
|
||||
|
||||
<!-- Title of the notification to indicate the process of connecting to a wifi display. [CHAR LIMIT=50] -->
|
||||
<string name="wifi_display_notification_connecting_title">Starting screen cast</string>
|
||||
<!-- Message of the notification to indicate the process of connectig to a wifi display. [CHAR LIMIT=80] -->
|
||||
<string name="wifi_display_notification_connecting_message">Connecting to <xliff:g id="name">%1$s</xliff:g></string>
|
||||
<!-- Title of the notification to indicate an active wifi display connection. [CHAR LIMIT=50] -->
|
||||
<string name="wifi_display_notification_title">Wireless display is connected</string>
|
||||
<string name="wifi_display_notification_connected_title">Screen cast in progress</string>
|
||||
<!-- Message of the notification to indicate an active wifi display connection. [CHAR LIMIT=80] -->
|
||||
<string name="wifi_display_notification_message">This screen is showing on another device</string>
|
||||
<string name="wifi_display_notification_connected_message">Connected to <xliff:g id="name">%1$s</xliff:g></string>
|
||||
<!-- Label of a button to disconnect an active wifi display connection. [CHAR LIMIT=25] -->
|
||||
<string name="wifi_display_notification_disconnect">Disconnect</string>
|
||||
|
||||
|
@ -1099,6 +1099,8 @@
|
||||
<java-symbol type="drawable" name="ic_media_route_off_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_connecting_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_notification_cast_connecting" />
|
||||
<java-symbol type="drawable" name="ic_notification_cast_on" />
|
||||
<java-symbol type="drawable" name="cling_button" />
|
||||
<java-symbol type="drawable" name="cling_arrow_up" />
|
||||
<java-symbol type="drawable" name="cling_bg" />
|
||||
@ -1594,8 +1596,10 @@
|
||||
<java-symbol type="string" name="vpn_lockdown_error" />
|
||||
<java-symbol type="string" name="vpn_lockdown_config" />
|
||||
<java-symbol type="string" name="wallpaper_binding_label" />
|
||||
<java-symbol type="string" name="wifi_display_notification_title" />
|
||||
<java-symbol type="string" name="wifi_display_notification_message" />
|
||||
<java-symbol type="string" name="wifi_display_notification_connecting_title" />
|
||||
<java-symbol type="string" name="wifi_display_notification_connecting_message" />
|
||||
<java-symbol type="string" name="wifi_display_notification_connected_title" />
|
||||
<java-symbol type="string" name="wifi_display_notification_connected_message" />
|
||||
<java-symbol type="string" name="wifi_display_notification_disconnect" />
|
||||
<java-symbol type="style" name="Theme.Dialog.AppError" />
|
||||
<java-symbol type="style" name="Theme.Toast" />
|
||||
|
BIN
packages/SystemUI/res/drawable-hdpi/ic_qs_cast_available.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connected.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connecting_0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connecting_1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connecting_2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/ic_qs_cast_available.png
Normal file
After Width: | Height: | Size: 933 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connected.png
Normal file
After Width: | Height: | Size: 942 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connecting_0.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connecting_1.png
Normal file
After Width: | Height: | Size: 949 B |
BIN
packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connecting_2.png
Normal file
After Width: | Height: | Size: 958 B |
BIN
packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_available.png
Normal file
After Width: | Height: | Size: 796 B |
BIN
packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connected.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connecting_0.png
Normal file
After Width: | Height: | Size: 743 B |
BIN
packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connecting_1.png
Normal file
After Width: | Height: | Size: 765 B |
BIN
packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connecting_2.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_available.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_connected.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
26
packages/SystemUI/res/drawable/ic_qs_cast_connecting.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2013, 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.
|
||||
*/
|
||||
-->
|
||||
<animation-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<item android:drawable="@drawable/ic_qs_cast_connecting_0" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_qs_cast_connecting_1" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_qs_cast_connecting_2" android:duration="500" />
|
||||
<item android:drawable="@drawable/ic_qs_cast_connecting_1" android:duration="500" />
|
||||
</animation-list>
|
@ -491,7 +491,7 @@
|
||||
<!-- QuickSettings: Wifi (Off) [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_wifi_off_label">Wi-Fi Off</string>
|
||||
<!-- QuickSettings: Remote display [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_remote_display_no_connection_label">Cast Screen</string>
|
||||
<string name="quick_settings_remote_display_no_connection_label">Screen Cast</string>
|
||||
<!-- QuickSettings: Brightness dialog title [CHAR LIMIT=NONE] -->
|
||||
<string name="quick_settings_brightness_dialog_title">Brightness</string>
|
||||
<!-- QuickSettings: Brightness dialog auto brightness button [CHAR LIMIT=NONE] -->
|
||||
|
@ -706,13 +706,11 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
|
||||
if (connectedRoute != null) {
|
||||
mRemoteDisplayState.label = connectedRoute.getName().toString();
|
||||
mRemoteDisplayState.iconId = connecting ?
|
||||
com.android.internal.R.drawable.ic_media_route_connecting_holo_dark :
|
||||
com.android.internal.R.drawable.ic_media_route_on_holo_dark;
|
||||
R.drawable.ic_qs_cast_connecting : R.drawable.ic_qs_cast_connected;
|
||||
} else {
|
||||
mRemoteDisplayState.label = mContext.getString(
|
||||
R.string.quick_settings_remote_display_no_connection_label);
|
||||
mRemoteDisplayState.iconId =
|
||||
com.android.internal.R.drawable.ic_media_route_off_holo_dark;
|
||||
mRemoteDisplayState.iconId = R.drawable.ic_qs_cast_available;
|
||||
}
|
||||
mRemoteDisplayCallback.refreshView(mRemoteDisplayTile, mRemoteDisplayState);
|
||||
}
|
||||
|
@ -400,8 +400,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mDisplayDevice = new WifiDisplayDevice(displayToken, name, width, height,
|
||||
refreshRate, deviceFlags, address, surface);
|
||||
sendDisplayDeviceEventLocked(mDisplayDevice, DISPLAY_DEVICE_EVENT_ADDED);
|
||||
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
|
||||
private void removeDisplayDeviceLocked() {
|
||||
@ -409,8 +407,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mDisplayDevice.destroyLocked();
|
||||
sendDisplayDeviceEventLocked(mDisplayDevice, DISPLAY_DEVICE_EVENT_REMOVED);
|
||||
mDisplayDevice = null;
|
||||
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,21 +453,24 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
|
||||
// Runs on the handler.
|
||||
private void handleUpdateNotification() {
|
||||
final boolean isConnected;
|
||||
final int state;
|
||||
final WifiDisplay display;
|
||||
synchronized (getSyncRoot()) {
|
||||
if (!mPendingNotificationUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPendingNotificationUpdate = false;
|
||||
isConnected = (mDisplayDevice != null);
|
||||
state = mActiveDisplayState;
|
||||
display = mActiveDisplay;
|
||||
}
|
||||
|
||||
// Cancel the old notification if there is one.
|
||||
mNotificationManager.cancelAsUser(null,
|
||||
R.string.wifi_display_notification_title, UserHandle.ALL);
|
||||
R.string.wifi_display_notification_disconnect, UserHandle.ALL);
|
||||
|
||||
if (isConnected) {
|
||||
if (state == WifiDisplayStatus.DISPLAY_STATE_CONNECTING
|
||||
|| state == WifiDisplayStatus.DISPLAY_STATE_CONNECTED) {
|
||||
Context context = getContext();
|
||||
|
||||
// Initialize pending intents for the notification outside of the lock because
|
||||
@ -493,20 +492,38 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
|
||||
// Post the notification.
|
||||
Resources r = context.getResources();
|
||||
Notification notification = new Notification.Builder(context)
|
||||
.setContentTitle(r.getString(
|
||||
R.string.wifi_display_notification_title))
|
||||
.setContentText(r.getString(
|
||||
R.string.wifi_display_notification_message))
|
||||
.setContentIntent(mSettingsPendingIntent)
|
||||
.setSmallIcon(R.drawable.ic_media_route_on_holo_dark)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
||||
r.getString(R.string.wifi_display_notification_disconnect),
|
||||
mDisconnectPendingIntent)
|
||||
.build();
|
||||
Notification notification;
|
||||
if (state == WifiDisplayStatus.DISPLAY_STATE_CONNECTING) {
|
||||
notification = new Notification.Builder(context)
|
||||
.setContentTitle(r.getString(
|
||||
R.string.wifi_display_notification_connecting_title))
|
||||
.setContentText(r.getString(
|
||||
R.string.wifi_display_notification_connecting_message,
|
||||
display.getFriendlyDisplayName()))
|
||||
.setContentIntent(mSettingsPendingIntent)
|
||||
.setSmallIcon(R.drawable.ic_notification_cast_connecting)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
||||
r.getString(R.string.wifi_display_notification_disconnect),
|
||||
mDisconnectPendingIntent)
|
||||
.build();
|
||||
} else {
|
||||
notification = new Notification.Builder(context)
|
||||
.setContentTitle(r.getString(
|
||||
R.string.wifi_display_notification_connected_title))
|
||||
.setContentText(r.getString(
|
||||
R.string.wifi_display_notification_connected_message,
|
||||
display.getFriendlyDisplayName()))
|
||||
.setContentIntent(mSettingsPendingIntent)
|
||||
.setSmallIcon(R.drawable.ic_notification_cast_on)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
||||
r.getString(R.string.wifi_display_notification_disconnect),
|
||||
mDisconnectPendingIntent)
|
||||
.build();
|
||||
}
|
||||
mNotificationManager.notifyAsUser(null,
|
||||
R.string.wifi_display_notification_title,
|
||||
R.string.wifi_display_notification_disconnect,
|
||||
notification, UserHandle.ALL);
|
||||
}
|
||||
}
|
||||
@ -578,6 +595,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTING;
|
||||
mActiveDisplay = display;
|
||||
scheduleStatusChangedBroadcastLocked();
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -590,6 +608,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
|
||||
mActiveDisplay = null;
|
||||
scheduleStatusChangedBroadcastLocked();
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -607,6 +626,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTED;
|
||||
mActiveDisplay = display;
|
||||
scheduleStatusChangedBroadcastLocked();
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -629,6 +649,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mActiveDisplay = display;
|
||||
renameDisplayDeviceLocked(display.getFriendlyDisplayName());
|
||||
scheduleStatusChangedBroadcastLocked();
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -644,6 +665,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
|
||||
mActiveDisplay = null;
|
||||
scheduleStatusChangedBroadcastLocked();
|
||||
scheduleUpdateNotificationLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
private static final int DEFAULT_CONTROL_PORT = 7236;
|
||||
private static final int MAX_THROUGHPUT = 50;
|
||||
private static final int CONNECTION_TIMEOUT_SECONDS = 60;
|
||||
private static final int RTSP_TIMEOUT_SECONDS = 15;
|
||||
private static final int RTSP_TIMEOUT_SECONDS = 30;
|
||||
private static final int RTSP_TIMEOUT_SECONDS_CERT_MODE = 120;
|
||||
|
||||
private static final int DISCOVER_PEERS_MAX_RETRIES = 10;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.media;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -116,7 +117,7 @@ public final class RemoteDisplayProviderWatcher {
|
||||
for (ResolveInfo resolveInfo : mPackageManager.queryIntentServicesAsUser(
|
||||
intent, 0, mUserId)) {
|
||||
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
|
||||
if (serviceInfo != null) {
|
||||
if (serviceInfo != null && verifyServiceTrusted(serviceInfo)) {
|
||||
int sourceIndex = findProvider(serviceInfo.packageName, serviceInfo.name);
|
||||
if (sourceIndex < 0) {
|
||||
RemoteDisplayProviderProxy provider =
|
||||
@ -146,6 +147,43 @@ public final class RemoteDisplayProviderWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean verifyServiceTrusted(ServiceInfo serviceInfo) {
|
||||
if (serviceInfo.permission == null || !serviceInfo.permission.equals(
|
||||
Manifest.permission.BIND_REMOTE_DISPLAY)) {
|
||||
// If the service does not require this permission then any app could
|
||||
// potentially bind to it and cause the remote display service to
|
||||
// misbehave. So we only want to trust providers that require the
|
||||
// correct permissions.
|
||||
Slog.w(TAG, "Ignoring remote display provider service because it did not "
|
||||
+ "require the BIND_REMOTE_DISPLAY permission in its manifest: "
|
||||
+ serviceInfo.packageName + "/" + serviceInfo.name);
|
||||
return false;
|
||||
}
|
||||
if (!hasCaptureVideoPermission(serviceInfo.packageName)) {
|
||||
// If the service does not have permission to capture video then it
|
||||
// isn't going to be terribly useful as a remote display, is it?
|
||||
// Kind of makes you wonder what it's doing there in the first place.
|
||||
Slog.w(TAG, "Ignoring remote display provider service because it does not "
|
||||
+ "have the CAPTURE_VIDEO_OUTPUT or CAPTURE_SECURE_VIDEO_OUTPUT "
|
||||
+ "permission: " + serviceInfo.packageName + "/" + serviceInfo.name);
|
||||
return false;
|
||||
}
|
||||
// Looks good.
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean hasCaptureVideoPermission(String packageName) {
|
||||
if (mPackageManager.checkPermission(Manifest.permission.CAPTURE_VIDEO_OUTPUT,
|
||||
packageName) == PackageManager.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
}
|
||||
if (mPackageManager.checkPermission(Manifest.permission.CAPTURE_SECURE_VIDEO_OUTPUT,
|
||||
packageName) == PackageManager.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int findProvider(String packageName, String className) {
|
||||
int count = mProviders.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -22,4 +22,5 @@ LOCAL_SDK_VERSION := current
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res
|
||||
LOCAL_JAVA_LIBRARIES := com.android.media.remotedisplay
|
||||
LOCAL_CERTIFICATE := platform
|
||||
include $(BUILD_PACKAGE)
|
||||
|
@ -18,6 +18,7 @@
|
||||
package="com.android.media.remotedisplay.test" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="19" />
|
||||
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/>
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/ic_app">
|
||||
|