Loading services/java/com/android/server/display/DisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ abstract class DisplayAdapter { public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2; public static final int DISPLAY_DEVICE_EVENT_REMOVED = 3; // Called with SyncRoot lock held. public DisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, String name) { mSyncRoot = syncRoot; Loading services/java/com/android/server/display/HeadlessDisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.DisplayMetrics; final class HeadlessDisplayAdapter extends DisplayAdapter { private static final String TAG = "HeadlessDisplayAdapter"; // Called with SyncRoot lock held. public HeadlessDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener) { super(syncRoot, context, handler, listener, TAG); Loading services/java/com/android/server/display/LocalDisplayAdapter.java +4 −4 Original line number Diff line number Diff line Loading @@ -44,21 +44,21 @@ final class LocalDisplayAdapter extends DisplayAdapter { private final SparseArray<LocalDisplayDevice> mDevices = new SparseArray<LocalDisplayDevice>(); private final HotplugDisplayEventReceiver mHotplugReceiver; private HotplugDisplayEventReceiver mHotplugReceiver; private final PhysicalDisplayInfo mTempPhys = new PhysicalDisplayInfo(); // Called with SyncRoot lock held. public LocalDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener) { super(syncRoot, context, handler, listener, TAG); mHotplugReceiver = new HotplugDisplayEventReceiver(handler.getLooper()); } @Override public void registerLocked() { // TODO: listen for notifications from Surface Flinger about // built-in displays being added or removed and rescan as needed. super.registerLocked(); mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); scanDisplaysLocked(); } Loading services/java/com/android/server/display/OverlayDisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ final class OverlayDisplayAdapter extends DisplayAdapter { new ArrayList<OverlayDisplayHandle>(); private String mCurrentOverlaySetting = ""; // Called with SyncRoot lock held. public OverlayDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, Handler uiHandler) { super(syncRoot, context, handler, listener, TAG); Loading services/java/com/android/server/display/WifiDisplayAdapter.java +25 −16 Original line number Diff line number Diff line Loading @@ -73,8 +73,8 @@ final class WifiDisplayAdapter extends DisplayAdapter { private final boolean mSupportsProtectedBuffers; private final NotificationManager mNotificationManager; private final PendingIntent mSettingsPendingIntent; private final PendingIntent mDisconnectPendingIntent; private PendingIntent mSettingsPendingIntent; private PendingIntent mDisconnectPendingIntent; private WifiDisplayController mDisplayController; private WifiDisplayDevice mDisplayDevice; Loading @@ -90,6 +90,7 @@ final class WifiDisplayAdapter extends DisplayAdapter { private boolean mPendingStatusChangeBroadcast; private boolean mPendingNotificationUpdate; // Called with SyncRoot lock held. public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, PersistentDataStore persistentDataStore) { Loading @@ -100,20 +101,6 @@ final class WifiDisplayAdapter extends DisplayAdapter { com.android.internal.R.bool.config_wifiDisplaySupportsProtectedBuffers); mNotificationManager = (NotificationManager)context.getSystemService( Context.NOTIFICATION_SERVICE); Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSettingsPendingIntent = PendingIntent.getActivityAsUser( context, 0, settingsIntent, 0, null, UserHandle.CURRENT); Intent disconnectIntent = new Intent(ACTION_DISCONNECT); mDisconnectPendingIntent = PendingIntent.getBroadcastAsUser( context, 0, disconnectIntent, 0, UserHandle.CURRENT); context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, new IntentFilter(ACTION_DISCONNECT), null, mHandler); } @Override Loading Loading @@ -153,6 +140,9 @@ final class WifiDisplayAdapter extends DisplayAdapter { public void run() { mDisplayController = new WifiDisplayController( getContext(), getHandler(), mWifiDisplayListener); getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, new IntentFilter(ACTION_DISCONNECT), null, mHandler); } }); } Loading Loading @@ -366,12 +356,31 @@ final class WifiDisplayAdapter extends DisplayAdapter { isConnected = (mDisplayDevice != null); } // Cancel the old notification if there is one. mNotificationManager.cancelAsUser(null, R.string.wifi_display_notification_title, UserHandle.ALL); if (isConnected) { Context context = getContext(); // Initialize pending intents for the notification outside of the lock because // creating a pending intent requires a call into the activity manager. if (mSettingsPendingIntent == null) { Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSettingsPendingIntent = PendingIntent.getActivityAsUser( context, 0, settingsIntent, 0, null, UserHandle.CURRENT); } if (mDisconnectPendingIntent == null) { Intent disconnectIntent = new Intent(ACTION_DISCONNECT); mDisconnectPendingIntent = PendingIntent.getBroadcastAsUser( context, 0, disconnectIntent, 0, UserHandle.CURRENT); } // Post the notification. Resources r = context.getResources(); Notification notification = new Notification.Builder(context) .setContentTitle(r.getString( Loading Loading
services/java/com/android/server/display/DisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ abstract class DisplayAdapter { public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2; public static final int DISPLAY_DEVICE_EVENT_REMOVED = 3; // Called with SyncRoot lock held. public DisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, String name) { mSyncRoot = syncRoot; Loading
services/java/com/android/server/display/HeadlessDisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.DisplayMetrics; final class HeadlessDisplayAdapter extends DisplayAdapter { private static final String TAG = "HeadlessDisplayAdapter"; // Called with SyncRoot lock held. public HeadlessDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener) { super(syncRoot, context, handler, listener, TAG); Loading
services/java/com/android/server/display/LocalDisplayAdapter.java +4 −4 Original line number Diff line number Diff line Loading @@ -44,21 +44,21 @@ final class LocalDisplayAdapter extends DisplayAdapter { private final SparseArray<LocalDisplayDevice> mDevices = new SparseArray<LocalDisplayDevice>(); private final HotplugDisplayEventReceiver mHotplugReceiver; private HotplugDisplayEventReceiver mHotplugReceiver; private final PhysicalDisplayInfo mTempPhys = new PhysicalDisplayInfo(); // Called with SyncRoot lock held. public LocalDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener) { super(syncRoot, context, handler, listener, TAG); mHotplugReceiver = new HotplugDisplayEventReceiver(handler.getLooper()); } @Override public void registerLocked() { // TODO: listen for notifications from Surface Flinger about // built-in displays being added or removed and rescan as needed. super.registerLocked(); mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); scanDisplaysLocked(); } Loading
services/java/com/android/server/display/OverlayDisplayAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ final class OverlayDisplayAdapter extends DisplayAdapter { new ArrayList<OverlayDisplayHandle>(); private String mCurrentOverlaySetting = ""; // Called with SyncRoot lock held. public OverlayDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, Handler uiHandler) { super(syncRoot, context, handler, listener, TAG); Loading
services/java/com/android/server/display/WifiDisplayAdapter.java +25 −16 Original line number Diff line number Diff line Loading @@ -73,8 +73,8 @@ final class WifiDisplayAdapter extends DisplayAdapter { private final boolean mSupportsProtectedBuffers; private final NotificationManager mNotificationManager; private final PendingIntent mSettingsPendingIntent; private final PendingIntent mDisconnectPendingIntent; private PendingIntent mSettingsPendingIntent; private PendingIntent mDisconnectPendingIntent; private WifiDisplayController mDisplayController; private WifiDisplayDevice mDisplayDevice; Loading @@ -90,6 +90,7 @@ final class WifiDisplayAdapter extends DisplayAdapter { private boolean mPendingStatusChangeBroadcast; private boolean mPendingNotificationUpdate; // Called with SyncRoot lock held. public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, Listener listener, PersistentDataStore persistentDataStore) { Loading @@ -100,20 +101,6 @@ final class WifiDisplayAdapter extends DisplayAdapter { com.android.internal.R.bool.config_wifiDisplaySupportsProtectedBuffers); mNotificationManager = (NotificationManager)context.getSystemService( Context.NOTIFICATION_SERVICE); Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSettingsPendingIntent = PendingIntent.getActivityAsUser( context, 0, settingsIntent, 0, null, UserHandle.CURRENT); Intent disconnectIntent = new Intent(ACTION_DISCONNECT); mDisconnectPendingIntent = PendingIntent.getBroadcastAsUser( context, 0, disconnectIntent, 0, UserHandle.CURRENT); context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, new IntentFilter(ACTION_DISCONNECT), null, mHandler); } @Override Loading Loading @@ -153,6 +140,9 @@ final class WifiDisplayAdapter extends DisplayAdapter { public void run() { mDisplayController = new WifiDisplayController( getContext(), getHandler(), mWifiDisplayListener); getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, new IntentFilter(ACTION_DISCONNECT), null, mHandler); } }); } Loading Loading @@ -366,12 +356,31 @@ final class WifiDisplayAdapter extends DisplayAdapter { isConnected = (mDisplayDevice != null); } // Cancel the old notification if there is one. mNotificationManager.cancelAsUser(null, R.string.wifi_display_notification_title, UserHandle.ALL); if (isConnected) { Context context = getContext(); // Initialize pending intents for the notification outside of the lock because // creating a pending intent requires a call into the activity manager. if (mSettingsPendingIntent == null) { Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); mSettingsPendingIntent = PendingIntent.getActivityAsUser( context, 0, settingsIntent, 0, null, UserHandle.CURRENT); } if (mDisconnectPendingIntent == null) { Intent disconnectIntent = new Intent(ACTION_DISCONNECT); mDisconnectPendingIntent = PendingIntent.getBroadcastAsUser( context, 0, disconnectIntent, 0, UserHandle.CURRENT); } // Post the notification. Resources r = context.getResources(); Notification notification = new Notification.Builder(context) .setContentTitle(r.getString( Loading