Merge "Changes to support new screen cast settings screen." into klp-dev
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>;
|
* @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>.
|
* greater than 0 if this Preference sorts after <var>another</var>.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int compareTo(Preference another) {
|
public int compareTo(Preference another) {
|
||||||
if (mOrder != DEFAULT_ORDER
|
if (mOrder != another.mOrder) {
|
||||||
|| (mOrder == DEFAULT_ORDER && another.mOrder != DEFAULT_ORDER)) {
|
|
||||||
// Do order comparison
|
// Do order comparison
|
||||||
return mOrder - another.mOrder;
|
return mOrder - another.mOrder;
|
||||||
} else if (mTitle == another.mTitle) {
|
} else if (mTitle == another.mTitle) {
|
||||||
// If titles are null or share same object comparison
|
// If titles are null or share same object comparison
|
||||||
return 0;
|
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="config_defaultNotificationColor" />
|
||||||
<java-symbol type="color" name="input_method_navigation_guard" />
|
<java-symbol type="color" name="input_method_navigation_guard" />
|
||||||
<java-symbol type="drawable" name="ic_notification_ime_default" />
|
<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="ic_menu_refresh" />
|
||||||
<java-symbol type="drawable" name="stat_notify_car_mode" />
|
<java-symbol type="drawable" name="stat_notify_car_mode" />
|
||||||
<java-symbol type="drawable" name="stat_notify_disabled" />
|
<java-symbol type="drawable" name="stat_notify_disabled" />
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class MediaRouter {
|
|||||||
|
|
||||||
static class Static implements DisplayManager.DisplayListener {
|
static class Static implements DisplayManager.DisplayListener {
|
||||||
// Time between wifi display scans when actively scanning in milliseconds.
|
// 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 Context mAppContext;
|
||||||
final Resources mResources;
|
final Resources mResources;
|
||||||
@@ -82,7 +82,6 @@ public class MediaRouter {
|
|||||||
|
|
||||||
RouteInfo mSelectedRoute;
|
RouteInfo mSelectedRoute;
|
||||||
|
|
||||||
WifiDisplayStatus mLastKnownWifiDisplayStatus;
|
|
||||||
boolean mActivelyScanningWifiDisplays;
|
boolean mActivelyScanningWifiDisplays;
|
||||||
|
|
||||||
int mDiscoveryRequestRouteTypes;
|
int mDiscoveryRequestRouteTypes;
|
||||||
@@ -1244,60 +1243,57 @@ public class MediaRouter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateWifiDisplayStatus(WifiDisplayStatus newStatus) {
|
static void updateWifiDisplayStatus(WifiDisplayStatus status) {
|
||||||
final WifiDisplayStatus oldStatus = sStatic.mLastKnownWifiDisplayStatus;
|
|
||||||
|
|
||||||
// TODO Naive implementation. Make this smarter later.
|
|
||||||
boolean wantScan = false;
|
boolean wantScan = false;
|
||||||
boolean blockScan = false;
|
WifiDisplay[] displays;
|
||||||
WifiDisplay[] oldDisplays = oldStatus != null ?
|
|
||||||
oldStatus.getDisplays() : WifiDisplay.EMPTY_ARRAY;
|
|
||||||
WifiDisplay[] newDisplays;
|
|
||||||
WifiDisplay activeDisplay;
|
WifiDisplay activeDisplay;
|
||||||
|
|
||||||
if (newStatus.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
|
if (status.getFeatureState() == WifiDisplayStatus.FEATURE_STATE_ON) {
|
||||||
newDisplays = newStatus.getDisplays();
|
displays = status.getDisplays();
|
||||||
activeDisplay = newStatus.getActiveDisplay();
|
activeDisplay = status.getActiveDisplay();
|
||||||
} else {
|
} else {
|
||||||
newDisplays = WifiDisplay.EMPTY_ARRAY;
|
displays = WifiDisplay.EMPTY_ARRAY;
|
||||||
activeDisplay = null;
|
activeDisplay = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < newDisplays.length; i++) {
|
// Add or update routes.
|
||||||
final WifiDisplay d = newDisplays[i];
|
for (int i = 0; i < displays.length; i++) {
|
||||||
if (d.isRemembered()) {
|
final WifiDisplay d = displays[i];
|
||||||
|
if (shouldShowWifiDisplay(d, activeDisplay)) {
|
||||||
RouteInfo route = findWifiDisplayRoute(d);
|
RouteInfo route = findWifiDisplayRoute(d);
|
||||||
if (route == null) {
|
if (route == null) {
|
||||||
route = makeWifiDisplayRoute(d, newStatus);
|
route = makeWifiDisplayRoute(d, status);
|
||||||
addRouteStatic(route);
|
addRouteStatic(route);
|
||||||
wantScan = true;
|
wantScan = true;
|
||||||
} else {
|
} else {
|
||||||
updateWifiDisplayRoute(route, d, newStatus);
|
updateWifiDisplayRoute(route, d, status);
|
||||||
}
|
}
|
||||||
if (d.equals(activeDisplay)) {
|
if (d.equals(activeDisplay)) {
|
||||||
selectRouteStatic(route.getSupportedTypes(), route, false);
|
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.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) {
|
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++) {
|
for (int i = 0; i < displays.length; i++) {
|
||||||
final WifiDisplay other = displays[i];
|
final WifiDisplay d = displays[i];
|
||||||
if (d.hasSameAddress(other)) {
|
if (d.getDeviceAddress().equals(deviceAddress)) {
|
||||||
return other;
|
return d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -1804,6 +1800,11 @@ public class MediaRouter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public String getDeviceAddress() {
|
||||||
|
return mDeviceAddress;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this route is enabled and may be selected.
|
* Returns true if this route is enabled and may be selected.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ final class WifiDisplayAdapter extends DisplayAdapter {
|
|||||||
.setContentText(r.getString(
|
.setContentText(r.getString(
|
||||||
R.string.wifi_display_notification_message))
|
R.string.wifi_display_notification_message))
|
||||||
.setContentIntent(mSettingsPendingIntent)
|
.setContentIntent(mSettingsPendingIntent)
|
||||||
.setSmallIcon(R.drawable.ic_notify_wifidisplay)
|
.setSmallIcon(R.drawable.ic_media_route_on_holo_dark)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
|
||||||
r.getString(R.string.wifi_display_notification_disconnect),
|
r.getString(R.string.wifi_display_notification_disconnect),
|
||||||
|
|||||||
Reference in New Issue
Block a user