Merge "Enable sensor use notification on TVs." into sc-dev am: b4044c5f69
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15079802 Change-Id: Ieb360fefe03b8d006600b9519906a23f2a9bdecd
This commit is contained in:
committed by
Automerger Merge Worker
commit
ee4962cca6
@@ -59,6 +59,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.hardware.ISensorPrivacyListener;
|
||||
import android.hardware.ISensorPrivacyManager;
|
||||
@@ -611,9 +612,19 @@ public final class SensorPrivacyService extends SystemService {
|
||||
new Intent(Settings.ACTION_PRIVACY_SETTINGS),
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
| PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
.extend(new Notification.TvExtender())
|
||||
.setTimeoutAfter(isTelevision(mContext)
|
||||
? /* dismiss immediately */ 1
|
||||
: /* no timeout */ 0)
|
||||
.build());
|
||||
}
|
||||
|
||||
private boolean isTelevision(Context context) {
|
||||
int uiMode = context.getResources().getConfiguration().uiMode;
|
||||
return (uiMode & Configuration.UI_MODE_TYPE_MASK)
|
||||
== Configuration.UI_MODE_TYPE_TELEVISION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sensor privacy to the provided state and notifies all listeners of the new
|
||||
* state.
|
||||
|
||||
Reference in New Issue
Block a user