Merge "Enable sensor use notification on TVs." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b4044c5f69
@@ -59,6 +59,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.hardware.ISensorPrivacyListener;
|
import android.hardware.ISensorPrivacyListener;
|
||||||
import android.hardware.ISensorPrivacyManager;
|
import android.hardware.ISensorPrivacyManager;
|
||||||
@@ -611,9 +612,19 @@ public final class SensorPrivacyService extends SystemService {
|
|||||||
new Intent(Settings.ACTION_PRIVACY_SETTINGS),
|
new Intent(Settings.ACTION_PRIVACY_SETTINGS),
|
||||||
PendingIntent.FLAG_IMMUTABLE
|
PendingIntent.FLAG_IMMUTABLE
|
||||||
| PendingIntent.FLAG_UPDATE_CURRENT))
|
| PendingIntent.FLAG_UPDATE_CURRENT))
|
||||||
|
.extend(new Notification.TvExtender())
|
||||||
|
.setTimeoutAfter(isTelevision(mContext)
|
||||||
|
? /* dismiss immediately */ 1
|
||||||
|
: /* no timeout */ 0)
|
||||||
.build());
|
.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
|
* Sets the sensor privacy to the provided state and notifies all listeners of the new
|
||||||
* state.
|
* state.
|
||||||
|
|||||||
Reference in New Issue
Block a user