Loading core/java/android/app/NotificationChannel.java +35 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Parcelable; import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.text.TextUtils; import android.util.proto.ProtoOutputStream; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -135,12 +136,15 @@ public final class NotificationChannel implements Parcelable { private boolean mLights; private int mLightColor = DEFAULT_LIGHT_COLOR; private long[] mVibration; // Bitwise representation of fields that have been changed by the user, preventing the app from // making changes to these fields. private int mUserLockedFields; private boolean mVibrationEnabled; private boolean mShowBadge = DEFAULT_SHOW_BADGE; private boolean mDeleted = DEFAULT_DELETED; private String mGroup; private AudioAttributes mAudioAttributes = Notification.AUDIO_ATTRIBUTES_DEFAULT; // If this is a blockable system notification channel. private boolean mBlockableSystem = false; /** Loading Loading @@ -850,4 +854,35 @@ public final class NotificationChannel implements Parcelable { + ", mBlockableSystem=" + mBlockableSystem + '}'; } /** @hide */ public void toProto(ProtoOutputStream proto) { proto.write(NotificationChannelProto.ID, mId); proto.write(NotificationChannelProto.NAME, mName); proto.write(NotificationChannelProto.DESCRIPTION, mDesc); proto.write(NotificationChannelProto.IMPORTANCE, mImportance); proto.write(NotificationChannelProto.CAN_BYPASS_DND, mBypassDnd); proto.write(NotificationChannelProto.LOCKSCREEN_VISIBILITY, mLockscreenVisibility); if (mSound != null) { proto.write(NotificationChannelProto.SOUND, mSound.toString()); } proto.write(NotificationChannelProto.USE_LIGHTS, mLights); proto.write(NotificationChannelProto.LIGHT_COLOR, mLightColor); if (mVibration != null) { for (long v : mVibration) { proto.write(NotificationChannelProto.VIBRATION, v); } } proto.write(NotificationChannelProto.USER_LOCKED_FIELDS, mUserLockedFields); proto.write(NotificationChannelProto.IS_VIBRATION_ENABLED, mVibrationEnabled); proto.write(NotificationChannelProto.SHOW_BADGE, mShowBadge); proto.write(NotificationChannelProto.IS_DELETED, mDeleted); proto.write(NotificationChannelProto.GROUP, mGroup); if (mAudioAttributes != null) { long aToken = proto.start(NotificationChannelProto.AUDIO_ATTRIBUTES); mAudioAttributes.toProto(proto); proto.end(aToken); } proto.write(NotificationChannelProto.IS_BLOCKABLE_SYSTEM, mBlockableSystem); } } core/java/android/app/NotificationChannelGroup.java +12 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.proto.ProtoOutputStream; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -295,4 +296,15 @@ public final class NotificationChannelGroup implements Parcelable { + ", mChannels=" + mChannels + '}'; } /** @hide */ public void toProto(ProtoOutputStream proto) { proto.write(NotificationChannelGroupProto.ID, mId); proto.write(NotificationChannelGroupProto.NAME, mName.toString()); proto.write(NotificationChannelGroupProto.DESCRIPTION, mDescription); proto.write(NotificationChannelGroupProto.IS_BLOCKED, mBlocked); for (NotificationChannel channel : mChannels) { channel.toProto(proto); } } } core/java/android/util/proto/ProtoOutputStream.java +4 −1 Original line number Diff line number Diff line Loading @@ -2375,6 +2375,9 @@ public final class ProtoOutputStream { if (countString == null) { countString = "fieldCount=" + fieldCount; } if (countString.length() > 0) { countString += " "; } final long fieldType = fieldId & FIELD_TYPE_MASK; String typeString = getFieldTypeString(fieldType); Loading @@ -2382,7 +2385,7 @@ public final class ProtoOutputStream { typeString = "fieldType=" + fieldType; } return fieldCount + " " + typeString + " tag=" + ((int)fieldId) return countString + typeString + " tag=" + ((int) fieldId) + " fieldId=0x" + Long.toHexString(fieldId); } Loading core/proto/android/app/notification_channel.proto 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; import "frameworks/base/core/proto/android/media/audioattributes.proto"; /** * An android.app.NotificationChannel object. */ message NotificationChannelProto { string id = 1; string name = 2; string description = 3; int32 importance = 4; bool can_bypass_dnd = 5; // Default is VISIBILITY_NO_OVERRIDE (-1000). int32 lockscreen_visibility = 6; string sound = 7; bool use_lights = 8; // Default is 0. int32 light_color = 9; repeated int64 vibration = 10; // Bitwise representation of fields that have been changed by the user, // preventing the app from making changes to these fields. int32 user_locked_fields = 11; bool is_vibration_enabled = 12; // Default is true. bool show_badge = 13; // Default is false. bool is_deleted = 14; string group = 15; android.media.AudioAttributesProto audio_attributes = 16; // If this is a blockable system notification channel. bool is_blockable_system = 17; } core/proto/android/app/notification_channel_group.proto 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; import "frameworks/base/core/proto/android/app/notification_channel.proto"; /** * An android.app.NotificationChannelGroup object. */ message NotificationChannelGroupProto { string id = 1; string name = 2; string description = 3; bool is_blocked = 4; repeated android.app.NotificationChannelProto channels = 5; } Loading
core/java/android/app/NotificationChannel.java +35 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Parcelable; import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.text.TextUtils; import android.util.proto.ProtoOutputStream; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -135,12 +136,15 @@ public final class NotificationChannel implements Parcelable { private boolean mLights; private int mLightColor = DEFAULT_LIGHT_COLOR; private long[] mVibration; // Bitwise representation of fields that have been changed by the user, preventing the app from // making changes to these fields. private int mUserLockedFields; private boolean mVibrationEnabled; private boolean mShowBadge = DEFAULT_SHOW_BADGE; private boolean mDeleted = DEFAULT_DELETED; private String mGroup; private AudioAttributes mAudioAttributes = Notification.AUDIO_ATTRIBUTES_DEFAULT; // If this is a blockable system notification channel. private boolean mBlockableSystem = false; /** Loading Loading @@ -850,4 +854,35 @@ public final class NotificationChannel implements Parcelable { + ", mBlockableSystem=" + mBlockableSystem + '}'; } /** @hide */ public void toProto(ProtoOutputStream proto) { proto.write(NotificationChannelProto.ID, mId); proto.write(NotificationChannelProto.NAME, mName); proto.write(NotificationChannelProto.DESCRIPTION, mDesc); proto.write(NotificationChannelProto.IMPORTANCE, mImportance); proto.write(NotificationChannelProto.CAN_BYPASS_DND, mBypassDnd); proto.write(NotificationChannelProto.LOCKSCREEN_VISIBILITY, mLockscreenVisibility); if (mSound != null) { proto.write(NotificationChannelProto.SOUND, mSound.toString()); } proto.write(NotificationChannelProto.USE_LIGHTS, mLights); proto.write(NotificationChannelProto.LIGHT_COLOR, mLightColor); if (mVibration != null) { for (long v : mVibration) { proto.write(NotificationChannelProto.VIBRATION, v); } } proto.write(NotificationChannelProto.USER_LOCKED_FIELDS, mUserLockedFields); proto.write(NotificationChannelProto.IS_VIBRATION_ENABLED, mVibrationEnabled); proto.write(NotificationChannelProto.SHOW_BADGE, mShowBadge); proto.write(NotificationChannelProto.IS_DELETED, mDeleted); proto.write(NotificationChannelProto.GROUP, mGroup); if (mAudioAttributes != null) { long aToken = proto.start(NotificationChannelProto.AUDIO_ATTRIBUTES); mAudioAttributes.toProto(proto); proto.end(aToken); } proto.write(NotificationChannelProto.IS_BLOCKABLE_SYSTEM, mBlockableSystem); } }
core/java/android/app/NotificationChannelGroup.java +12 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.proto.ProtoOutputStream; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -295,4 +296,15 @@ public final class NotificationChannelGroup implements Parcelable { + ", mChannels=" + mChannels + '}'; } /** @hide */ public void toProto(ProtoOutputStream proto) { proto.write(NotificationChannelGroupProto.ID, mId); proto.write(NotificationChannelGroupProto.NAME, mName.toString()); proto.write(NotificationChannelGroupProto.DESCRIPTION, mDescription); proto.write(NotificationChannelGroupProto.IS_BLOCKED, mBlocked); for (NotificationChannel channel : mChannels) { channel.toProto(proto); } } }
core/java/android/util/proto/ProtoOutputStream.java +4 −1 Original line number Diff line number Diff line Loading @@ -2375,6 +2375,9 @@ public final class ProtoOutputStream { if (countString == null) { countString = "fieldCount=" + fieldCount; } if (countString.length() > 0) { countString += " "; } final long fieldType = fieldId & FIELD_TYPE_MASK; String typeString = getFieldTypeString(fieldType); Loading @@ -2382,7 +2385,7 @@ public final class ProtoOutputStream { typeString = "fieldType=" + fieldType; } return fieldCount + " " + typeString + " tag=" + ((int)fieldId) return countString + typeString + " tag=" + ((int) fieldId) + " fieldId=0x" + Long.toHexString(fieldId); } Loading
core/proto/android/app/notification_channel.proto 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; import "frameworks/base/core/proto/android/media/audioattributes.proto"; /** * An android.app.NotificationChannel object. */ message NotificationChannelProto { string id = 1; string name = 2; string description = 3; int32 importance = 4; bool can_bypass_dnd = 5; // Default is VISIBILITY_NO_OVERRIDE (-1000). int32 lockscreen_visibility = 6; string sound = 7; bool use_lights = 8; // Default is 0. int32 light_color = 9; repeated int64 vibration = 10; // Bitwise representation of fields that have been changed by the user, // preventing the app from making changes to these fields. int32 user_locked_fields = 11; bool is_vibration_enabled = 12; // Default is true. bool show_badge = 13; // Default is false. bool is_deleted = 14; string group = 15; android.media.AudioAttributesProto audio_attributes = 16; // If this is a blockable system notification channel. bool is_blockable_system = 17; }
core/proto/android/app/notification_channel_group.proto 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; option java_package = "android.app"; option java_multiple_files = true; package android.app; import "frameworks/base/core/proto/android/app/notification_channel.proto"; /** * An android.app.NotificationChannelGroup object. */ message NotificationChannelGroupProto { string id = 1; string name = 2; string description = 3; bool is_blocked = 4; repeated android.app.NotificationChannelProto channels = 5; }