am 1cdbbb1e
: Merge "Changes to support new screen cast settings screen." into klp-dev
* commit '1cdbbb1e73bff05f5dd1679bae2e3502d4f82368': Changes to support new screen cast settings screen.
This commit is contained in:
@ -1069,11 +1069,11 @@ public class Preference implements Comparable<Preference> {
|
||||
* @return 0 if the same; less than 0 if this Preference sorts ahead of <var>another</var>;
|
||||
* greater than 0 if this Preference sorts after <var>another</var>.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Preference another) {
|
||||
if (mOrder != DEFAULT_ORDER
|
||||
|| (mOrder == DEFAULT_ORDER && another.mOrder != DEFAULT_ORDER)) {
|
||||
if (mOrder != another.mOrder) {
|
||||
// Do order comparison
|
||||
return mOrder - another.mOrder;
|
||||
return mOrder - another.mOrder;
|
||||
} else if (mTitle == another.mTitle) {
|
||||
// If titles are null or share same object comparison
|
||||
return 0;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 941 B |
Binary file not shown.
Before Width: | Height: | Size: 721 B |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
@ -1452,7 +1452,6 @@
|
||||
<java-symbol type="color" name="config_defaultNotificationColor" />
|
||||
<java-symbol type="color" name="input_method_navigation_guard" />
|
||||
<java-symbol type="drawable" name="ic_notification_ime_default" />
|
||||
<java-symbol type="drawable" name="ic_notify_wifidisplay" />
|
||||
<java-symbol type="drawable" name="ic_menu_refresh" />
|
||||
<java-symbol type="drawable" name="stat_notify_car_mode" />
|
||||
<java-symbol type="drawable" name="stat_notify_disabled" />
|
||||
|
@ -59,7 +59,7 @@ public class MediaRouter {
|
||||
|
||||
static class Static implements DisplayManager.DisplayListener {
|
||||
// Time between wifi display scans when actively scanning in milliseconds.
|
||||
private static final int WIFI_DISPLAY_SCAN_INTERVAL = 15000;
|
||||
private static final int WIFI_DISPLAY_SCAN_INTERVAL = 10000;
|
||||
|
||||
final Context mAppContext;
|
||||
final Resources mResources;
|
||||
@ -82,7 +82,6 @@ public class MediaRouter {
|
||||
|
||||
RouteInfo mSelectedRoute;
|
||||
|
||||
WifiDisplayStatus mLastKnownWifiDisplayStatus;
|
||||
boolean mActivelyScanningWifiDisplays;
|
||||
|
||||
int mDiscoveryRequestRouteTypes;
|
||||
@ -1244,60 +1243,57 @@ public class MediaRouter {
|
||||
}
|
||||
}
|
||||
|
||||
static void updateWifiDisplayStatus(WifiDisplayStatus newStatus) {
|
||||
final WifiDisplayStatus oldStatus = sStatic.mLastKnownWifiDisplayStatus;
|
||||
|
||||
// TODO Naive implementation. Make this smarter later.
|
||||
static void updateWifiDisplayStatus(WifiDisplayStatus status) {
|
||||
boolean wantScan = false;
|
||||
boolean blockScan = false;
|
||||
WifiDisplay[] oldDisplays = oldStatus != null ?
|
||||
oldStatus.getDisplays() : WifiDisplay.EMPTY_ARRAY;
|
||||
WifiDisplay[] newDisplays;
|
||||
WifiDisplay[] displays;
|
||||
WifiDisplay activeDisplay;
|
||||
|
||||
if (newStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
|
||||
newDisplays = newStatus.getDisplays();
|
||||
activeDisplay = newStatus.getActiveDisplay();
|
||||
if (status.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
|
||||
displays = status.getDisplays();
|
||||
activeDisplay = status.getActiveDisplay();
|
||||
} else {
|
||||
newDisplays = WifiDisplay.EMPTY_ARRAY;
|
||||
displays = WifiDisplay.EMPTY_ARRAY;
|
||||
activeDisplay = null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < newDisplays.length; i++) {
|
||||
final WifiDisplay d = newDisplays[i];
|
||||
if (d.isRemembered()) {
|
||||
// Add or update routes.
|
||||
for (int i = 0; i < displays.length; i++) {
|
||||
final WifiDisplay d = displays[i];
|
||||
if (shouldShowWifiDisplay(d, activeDisplay)) {
|
||||
RouteInfo route = findWifiDisplayRoute(d);
|
||||
if (route == null) {
|
||||
route = makeWifiDisplayRoute(d, newStatus);
|
||||
route = makeWifiDisplayRoute(d, status);
|
||||
addRouteStatic(route);
|
||||
wantScan = true;
|
||||
} else {
|
||||
updateWifiDisplayRoute(route, d, newStatus);
|
||||
updateWifiDisplayRoute(route, d, status);
|
||||
}
|
||||
if (d.equals(activeDisplay)) {
|
||||
selectRouteStatic(route.getSupportedTypes(), route, false);
|
||||
|
||||
// Don't scan if we're already connected to a wifi display,
|
||||
// the scanning process can cause a hiccup with some configurations.
|
||||
blockScan = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < oldDisplays.length; i++) {
|
||||
final WifiDisplay d = oldDisplays[i];
|
||||
if (d.isRemembered()) {
|
||||
final WifiDisplay newDisplay = findMatchingDisplay(d, newDisplays);
|
||||
if (newDisplay == null || !newDisplay.isRemembered()) {
|
||||
removeRouteStatic(findWifiDisplayRoute(d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wantScan && !blockScan) {
|
||||
// Remove stale routes.
|
||||
for (int i = sStatic.mRoutes.size(); i-- > 0; ) {
|
||||
RouteInfo route = sStatic.mRoutes.get(i);
|
||||
if (route.mDeviceAddress != null) {
|
||||
WifiDisplay d = findWifiDisplay(displays, route.mDeviceAddress);
|
||||
if (d == null || !shouldShowWifiDisplay(d, activeDisplay)) {
|
||||
removeRouteStatic(route);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't scan if we're already connected to a wifi display,
|
||||
// the scanning process can cause a hiccup with some configurations.
|
||||
if (wantScan && activeDisplay != null) {
|
||||
sStatic.mDisplayService.scanWifiDisplays();
|
||||
}
|
||||
}
|
||||
|
||||
sStatic.mLastKnownWifiDisplayStatus = newStatus;
|
||||
private static boolean shouldShowWifiDisplay(WifiDisplay d, WifiDisplay activeDisplay) {
|
||||
return d.isRemembered() || d.equals(activeDisplay);
|
||||
}
|
||||
|
||||
static int getWifiDisplayStatusCode(WifiDisplay d, WifiDisplayStatus wfdStatus) {
|
||||
@ -1375,11 +1371,11 @@ public class MediaRouter {
|
||||
}
|
||||
}
|
||||
|
||||
private static WifiDisplay findMatchingDisplay(WifiDisplay d, WifiDisplay[] displays) {
|
||||
private static WifiDisplay findWifiDisplay(WifiDisplay[] displays, String deviceAddress) {
|
||||
for (int i = 0; i < displays.length; i++) {
|
||||
final WifiDisplay other = displays[i];
|
||||
if (d.hasSameAddress(other)) {
|
||||
return other;
|
||||
final WifiDisplay d = displays[i];
|
||||
if (d.getDeviceAddress().equals(deviceAddress)) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -1804,6 +1800,11 @@ public class MediaRouter {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public String getDeviceAddress() {
|
||||
return mDeviceAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this route is enabled and may be selected.
|
||||
*
|
||||
|
@ -499,7 +499,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
||||
.setContentText(r.getString(
|
||||
R.string.wifi_display_notification_message))
|
||||
.setContentIntent(mSettingsPendingIntent)
|
||||
.setSmallIcon(R.drawable.ic_notify_wifidisplay)
|
||||
.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),
|
||||
|
Reference in New Issue
Block a user