Merge changes I6b52e378,I1699e6bf into nyc-dev
* changes: Phone call vibrate should obey user preference. Adjustment bundles are defusable.
This commit is contained in:
committed by
Android (Google) Code Review
commit
8a46d52304
@@ -454,6 +454,12 @@ public class VibratorService extends IVibratorService.Stub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vib.mUsageHint == AudioAttributes.USAGE_NOTIFICATION_RINGTONE
|
||||||
|
&& Settings.System.getInt(
|
||||||
|
mContext.getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, 0) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int mode = mAppOpsService.checkAudioOperation(AppOpsManager.OP_VIBRATE,
|
int mode = mAppOpsService.checkAudioOperation(AppOpsManager.OP_VIBRATE,
|
||||||
vib.mUsageHint, vib.mUid, vib.mOpPkg);
|
vib.mUsageHint, vib.mUid, vib.mOpPkg);
|
||||||
if (mode == AppOpsManager.MODE_ALLOWED) {
|
if (mode == AppOpsManager.MODE_ALLOWED) {
|
||||||
|
|||||||
@@ -2186,8 +2186,9 @@ public class NotificationManagerService extends SystemService {
|
|||||||
|
|
||||||
// Clears the 'fake' auto-bunding summary.
|
// Clears the 'fake' auto-bunding summary.
|
||||||
private void maybeClearAutobundleSummaryLocked(Adjustment adjustment) {
|
private void maybeClearAutobundleSummaryLocked(Adjustment adjustment) {
|
||||||
if (adjustment.getSignals() != null
|
if (adjustment.getSignals() != null) {
|
||||||
&& adjustment.getSignals().containsKey(Adjustment.NEEDS_AUTOGROUPING_KEY)
|
Bundle.setDefusable(adjustment.getSignals(), true);
|
||||||
|
if (adjustment.getSignals().containsKey(Adjustment.NEEDS_AUTOGROUPING_KEY)
|
||||||
&& !adjustment.getSignals().getBoolean(Adjustment.NEEDS_AUTOGROUPING_KEY, false)) {
|
&& !adjustment.getSignals().getBoolean(Adjustment.NEEDS_AUTOGROUPING_KEY, false)) {
|
||||||
if (mAutobundledSummaries.containsKey(adjustment.getPackage())) {
|
if (mAutobundledSummaries.containsKey(adjustment.getPackage())) {
|
||||||
// Clear summary.
|
// Clear summary.
|
||||||
@@ -2200,11 +2201,13 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Posts a 'fake' summary for a package that has exceeded the solo-notification limit.
|
// Posts a 'fake' summary for a package that has exceeded the solo-notification limit.
|
||||||
private void maybeAddAutobundleSummary(Adjustment adjustment) {
|
private void maybeAddAutobundleSummary(Adjustment adjustment) {
|
||||||
if (adjustment.getSignals() != null
|
if (adjustment.getSignals() != null) {
|
||||||
&& adjustment.getSignals().getBoolean(Adjustment.NEEDS_AUTOGROUPING_KEY, false)) {
|
Bundle.setDefusable(adjustment.getSignals(), true);
|
||||||
|
if (adjustment.getSignals().getBoolean(Adjustment.NEEDS_AUTOGROUPING_KEY, false)) {
|
||||||
final String newAutoBundleKey =
|
final String newAutoBundleKey =
|
||||||
adjustment.getSignals().getString(Adjustment.GROUP_KEY_OVERRIDE_KEY, null);
|
adjustment.getSignals().getString(Adjustment.GROUP_KEY_OVERRIDE_KEY, null);
|
||||||
int userId = -1;
|
int userId = -1;
|
||||||
@@ -2235,7 +2238,8 @@ public class NotificationManagerService extends SystemService {
|
|||||||
adjustedSbn.getOpPkg(),
|
adjustedSbn.getOpPkg(),
|
||||||
Integer.MAX_VALUE, Adjustment.GROUP_KEY_OVERRIDE_KEY,
|
Integer.MAX_VALUE, Adjustment.GROUP_KEY_OVERRIDE_KEY,
|
||||||
adjustedSbn.getUid(), adjustedSbn.getInitialPid(),
|
adjustedSbn.getUid(), adjustedSbn.getInitialPid(),
|
||||||
summaryNotification, adjustedSbn.getUser(), newAutoBundleKey,
|
summaryNotification, adjustedSbn.getUser(),
|
||||||
|
newAutoBundleKey,
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
summaryRecord = new NotificationRecord(getContext(), summarySbn);
|
summaryRecord = new NotificationRecord(getContext(), summarySbn);
|
||||||
mAutobundledSummaries.put(adjustment.getPackage(), summarySbn.getKey());
|
mAutobundledSummaries.put(adjustment.getPackage(), summarySbn.getKey());
|
||||||
@@ -2247,6 +2251,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String disableNotificationEffects(NotificationRecord record) {
|
private String disableNotificationEffects(NotificationRecord record) {
|
||||||
if (mDisableNotificationEffects) {
|
if (mDisableNotificationEffects) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.content.Intent;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -86,6 +87,28 @@ public class NotificationTestList extends TestActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Test[] mTests = new Test[] {
|
private Test[] mTests = new Test[] {
|
||||||
|
new Test("Phone call") {
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Notification n = new Notification.Builder(NotificationTestList.this)
|
||||||
|
.setSmallIcon(R.drawable.icon2)
|
||||||
|
.setContentTitle("phone call")
|
||||||
|
.setLights(0xff0000ff, 1, 0)
|
||||||
|
.setDefaults(Notification.DEFAULT_LIGHTS|Notification.DEFAULT_VIBRATE)
|
||||||
|
.setSound(Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
|
||||||
|
getPackageName() + "/raw/ringer"),
|
||||||
|
new AudioAttributes.Builder().setUsage(
|
||||||
|
AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build())
|
||||||
|
.setPriority(Notification.PRIORITY_MAX)
|
||||||
|
.setVibrate(new long[] {
|
||||||
|
300, 400, 300, 400, 300, 400, 300, 400, 300, 400, 300, 400,
|
||||||
|
300, 400, 300, 400, 300, 400, 300, 400, 300, 400, 300, 400,
|
||||||
|
300, 400, 300, 400, 300, 400, 300, 400, 300, 400, 300, 400 })
|
||||||
|
.setFullScreenIntent(makeIntent2(), true)
|
||||||
|
.build();
|
||||||
|
mNM.notify(7001, n);
|
||||||
|
}
|
||||||
|
},
|
||||||
new Test("Post a group") {
|
new Test("Post a group") {
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user