Loading core/java/android/app/Notification.java +38 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,44 @@ public class Notification implements Parcelable iconLevel = parcel.readInt(); } public Notification clone() { Notification that = new Notification(); that.when = this.when; that.icon = this.icon; that.number = this.number; // PendingIntents are global, so there's no reason (or way) to clone them. that.contentIntent = this.contentIntent; that.deleteIntent = this.deleteIntent; if (this.tickerText != null) { that.tickerText = this.tickerText.toString(); } if (this.contentView != null) { that.contentView = this.contentView.clone(); } that.iconLevel = that.iconLevel; that.sound = this.sound; // android.net.Uri is immutable that.audioStreamType = this.audioStreamType; final long[] vibrate = this.vibrate; if (vibrate != null) { final int N = vibrate.length; final long[] vib = that.vibrate = new long[N]; System.arraycopy(vibrate, 0, vib, 0, N); } that.ledARGB = this.ledARGB; that.ledOnMS = this.ledOnMS; that.ledOffMS = this.ledOffMS; that.defaults = this.defaults; that.flags = this.flags; return that; } public int describeContents() { return 0; } Loading core/java/android/widget/RemoteViews.java +9 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class RemoteViews implements Parcelable, Filter { * Base class for all actions that can be performed on an * inflated view. * * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! */ private abstract static class Action implements Parcelable { public abstract void apply(View root) throws ActionException; Loading Loading @@ -568,6 +569,14 @@ public class RemoteViews implements Parcelable, Filter { } } public RemoteViews clone() { final RemoteViews that = new RemoteViews(mPackage, mLayoutId); if (mActions != null) { that.mActions = (ArrayList<Action>)mActions.clone(); } return that; } public String getPackage() { return mPackage; } Loading core/java/com/android/internal/statusbar/StatusBarIcon.java +6 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ public class StatusBarIcon implements Parcelable { public int iconId; public int iconLevel; public boolean visible = true; public int number; private StatusBarIcon() { } Loading @@ -39,12 +40,14 @@ public class StatusBarIcon implements Parcelable { public String toString() { return "StatusBarIcon(pkg=" + this.iconPackage + " id=0x" + Integer.toHexString(this.iconId) + " level=" + this.iconLevel + " visible=" + visible + ")"; + " level=" + this.iconLevel + " visible=" + visible + " num=" + this.number + " )"; } public StatusBarIcon clone() { StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel); that.visible = this.visible; that.number = this.number; return that; } Loading @@ -60,13 +63,14 @@ public class StatusBarIcon implements Parcelable { this.iconId = in.readInt(); this.iconLevel = in.readInt(); this.visible = in.readInt() != 0; this.number = in.readInt(); } public void writeToParcel(Parcel out, int flags) { out.writeString(this.iconPackage); out.writeInt(this.iconId); out.writeInt(this.iconLevel); out.writeInt(this.visible ? 1 : 0); out.writeInt(this.number); } public int describeContents() { Loading core/java/com/android/internal/statusbar/StatusBarNotification.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2008 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. */ package com.android.internal.statusbar; import android.app.Notification; import android.os.Parcel; import android.os.Parcelable; import android.widget.RemoteViews; /* boolean clearable = !n.ongoingEvent && ((notification.flags & Notification.FLAG_NO_CLEAR) == 0); // TODO: make this restriction do something smarter like never fill // more than two screens. "Why would anyone need more than 80 characters." :-/ final int maxTickerLen = 80; if (truncatedTicker != null && truncatedTicker.length() > maxTickerLen) { truncatedTicker = truncatedTicker.subSequence(0, maxTickerLen); } */ public class StatusBarNotification implements Parcelable { public String pkg; public int id; public String tag; Notification notification; public StatusBarNotification() { } public StatusBarNotification(String pkg, int id, String tag, Notification notification) { if (pkg == null) throw new NullPointerException(); if (notification == null) throw new NullPointerException(); this.pkg = pkg; this.id = id; this.tag = tag; this.notification = notification; } public StatusBarNotification(Parcel in) { readFromParcel(in); } public void readFromParcel(Parcel in) { this.pkg = in.readString(); this.id = in.readInt(); if (in.readInt() != 0) { this.tag = in.readString(); } else { this.tag = null; } this.notification = new Notification(in); } public void writeToParcel(Parcel out, int flags) { out.writeString(this.pkg); out.writeInt(this.id); if (this.tag != null) { out.writeInt(1); out.writeString(this.tag); } else { out.writeInt(0); } this.notification.writeToParcel(out, flags); } public int describeContents() { return 0; } public static final Parcelable.Creator<StatusBarNotification> CREATOR = new Parcelable.Creator<StatusBarNotification>() { public StatusBarNotification createFromParcel(Parcel parcel) { return new StatusBarNotification(parcel); } public StatusBarNotification[] newArray(int size) { return new StatusBarNotification[size]; } }; public StatusBarNotification clone() { return new StatusBarNotification(this.pkg, this.id, this.tag, this.notification.clone()); } public String toString() { return "StatusBarNotification(package=" + pkg + " tag=" + tag + " notification=" + notification + ")"; } } services/java/com/android/server/status/StatusBarNotification.java→core/java/com/android/internal/statusbar/StatusBarNotificationList.aidl +11 −18 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * Copyright (c) 2010, 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. Loading @@ -14,14 +14,7 @@ * limitations under the License. */ package com.android.server.status; package com.android.internal.statusbar; import android.os.IBinder; import android.view.View; parcelable StatusBarNotificationList; public class StatusBarNotification { IBinder key; NotificationData data; View view; View contentView; } Loading
core/java/android/app/Notification.java +38 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,44 @@ public class Notification implements Parcelable iconLevel = parcel.readInt(); } public Notification clone() { Notification that = new Notification(); that.when = this.when; that.icon = this.icon; that.number = this.number; // PendingIntents are global, so there's no reason (or way) to clone them. that.contentIntent = this.contentIntent; that.deleteIntent = this.deleteIntent; if (this.tickerText != null) { that.tickerText = this.tickerText.toString(); } if (this.contentView != null) { that.contentView = this.contentView.clone(); } that.iconLevel = that.iconLevel; that.sound = this.sound; // android.net.Uri is immutable that.audioStreamType = this.audioStreamType; final long[] vibrate = this.vibrate; if (vibrate != null) { final int N = vibrate.length; final long[] vib = that.vibrate = new long[N]; System.arraycopy(vibrate, 0, vib, 0, N); } that.ledARGB = this.ledARGB; that.ledOnMS = this.ledOnMS; that.ledOffMS = this.ledOffMS; that.defaults = this.defaults; that.flags = this.flags; return that; } public int describeContents() { return 0; } Loading
core/java/android/widget/RemoteViews.java +9 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ public class RemoteViews implements Parcelable, Filter { * Base class for all actions that can be performed on an * inflated view. * * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! */ private abstract static class Action implements Parcelable { public abstract void apply(View root) throws ActionException; Loading Loading @@ -568,6 +569,14 @@ public class RemoteViews implements Parcelable, Filter { } } public RemoteViews clone() { final RemoteViews that = new RemoteViews(mPackage, mLayoutId); if (mActions != null) { that.mActions = (ArrayList<Action>)mActions.clone(); } return that; } public String getPackage() { return mPackage; } Loading
core/java/com/android/internal/statusbar/StatusBarIcon.java +6 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ public class StatusBarIcon implements Parcelable { public int iconId; public int iconLevel; public boolean visible = true; public int number; private StatusBarIcon() { } Loading @@ -39,12 +40,14 @@ public class StatusBarIcon implements Parcelable { public String toString() { return "StatusBarIcon(pkg=" + this.iconPackage + " id=0x" + Integer.toHexString(this.iconId) + " level=" + this.iconLevel + " visible=" + visible + ")"; + " level=" + this.iconLevel + " visible=" + visible + " num=" + this.number + " )"; } public StatusBarIcon clone() { StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel); that.visible = this.visible; that.number = this.number; return that; } Loading @@ -60,13 +63,14 @@ public class StatusBarIcon implements Parcelable { this.iconId = in.readInt(); this.iconLevel = in.readInt(); this.visible = in.readInt() != 0; this.number = in.readInt(); } public void writeToParcel(Parcel out, int flags) { out.writeString(this.iconPackage); out.writeInt(this.iconId); out.writeInt(this.iconLevel); out.writeInt(this.visible ? 1 : 0); out.writeInt(this.number); } public int describeContents() { Loading
core/java/com/android/internal/statusbar/StatusBarNotification.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2008 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. */ package com.android.internal.statusbar; import android.app.Notification; import android.os.Parcel; import android.os.Parcelable; import android.widget.RemoteViews; /* boolean clearable = !n.ongoingEvent && ((notification.flags & Notification.FLAG_NO_CLEAR) == 0); // TODO: make this restriction do something smarter like never fill // more than two screens. "Why would anyone need more than 80 characters." :-/ final int maxTickerLen = 80; if (truncatedTicker != null && truncatedTicker.length() > maxTickerLen) { truncatedTicker = truncatedTicker.subSequence(0, maxTickerLen); } */ public class StatusBarNotification implements Parcelable { public String pkg; public int id; public String tag; Notification notification; public StatusBarNotification() { } public StatusBarNotification(String pkg, int id, String tag, Notification notification) { if (pkg == null) throw new NullPointerException(); if (notification == null) throw new NullPointerException(); this.pkg = pkg; this.id = id; this.tag = tag; this.notification = notification; } public StatusBarNotification(Parcel in) { readFromParcel(in); } public void readFromParcel(Parcel in) { this.pkg = in.readString(); this.id = in.readInt(); if (in.readInt() != 0) { this.tag = in.readString(); } else { this.tag = null; } this.notification = new Notification(in); } public void writeToParcel(Parcel out, int flags) { out.writeString(this.pkg); out.writeInt(this.id); if (this.tag != null) { out.writeInt(1); out.writeString(this.tag); } else { out.writeInt(0); } this.notification.writeToParcel(out, flags); } public int describeContents() { return 0; } public static final Parcelable.Creator<StatusBarNotification> CREATOR = new Parcelable.Creator<StatusBarNotification>() { public StatusBarNotification createFromParcel(Parcel parcel) { return new StatusBarNotification(parcel); } public StatusBarNotification[] newArray(int size) { return new StatusBarNotification[size]; } }; public StatusBarNotification clone() { return new StatusBarNotification(this.pkg, this.id, this.tag, this.notification.clone()); } public String toString() { return "StatusBarNotification(package=" + pkg + " tag=" + tag + " notification=" + notification + ")"; } }
services/java/com/android/server/status/StatusBarNotification.java→core/java/com/android/internal/statusbar/StatusBarNotificationList.aidl +11 −18 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * Copyright (c) 2010, 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. Loading @@ -14,14 +14,7 @@ * limitations under the License. */ package com.android.server.status; package com.android.internal.statusbar; import android.os.IBinder; import android.view.View; parcelable StatusBarNotificationList; public class StatusBarNotification { IBinder key; NotificationData data; View view; View contentView; }