blob: 43151005f6730f14b3c5f22c4c117bc7a0796dcf [file] [log] [blame]
Joe Onorato18e69df2010-05-17 22:26:12 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Daniel Sandler5feceeb2013-03-22 18:29:23 -070017package android.service.notification;
Joe Onorato18e69df2010-05-17 22:26:12 -070018
Julia Reynoldscbc45e72019-03-07 12:31:52 -050019import android.annotation.NonNull;
Mathew Inwoode3807372018-08-10 09:51:03 +010020import android.annotation.UnsupportedAppUsage;
Joe Onorato18e69df2010-05-17 22:26:12 -070021import android.app.Notification;
Julia Reynoldsa7ba45a2018-08-29 09:07:52 -040022import android.app.NotificationManager;
Dan Sandler68079d52015-07-22 10:45:30 -040023import android.content.Context;
24import android.content.pm.ApplicationInfo;
25import android.content.pm.PackageManager;
Eyal Posenera9cf9c72018-12-18 16:23:54 +020026import android.metrics.LogMaker;
Mathew Inwood31755f92018-12-20 13:53:36 +000027import android.os.Build;
Joe Onorato18e69df2010-05-17 22:26:12 -070028import android.os.Parcel;
29import android.os.Parcelable;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070030import android.os.UserHandle;
Joe Onorato18e69df2010-05-17 22:26:12 -070031
Will Brockman828427e2019-01-28 09:55:45 -050032import com.android.internal.logging.nano.MetricsProto;
Eyal Posenera9cf9c72018-12-18 16:23:54 +020033import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
34
Daniel Sandler2561b0b2012-02-13 21:04:12 -050035/**
Daniel Sandlerfde19b12013-01-17 00:21:05 -050036 * Class encapsulating a Notification. Sent by the NotificationManagerService to clients including
Daniel Sandler5feceeb2013-03-22 18:29:23 -070037 * the status bar and any {@link android.service.notification.NotificationListenerService}s.
Daniel Sandler2561b0b2012-02-13 21:04:12 -050038 */
Joe Onorato18e69df2010-05-17 22:26:12 -070039public class StatusBarNotification implements Parcelable {
Eyal Posenera9cf9c72018-12-18 16:23:54 +020040 static final int MAX_LOG_TAG_LENGTH = 36;
41
Mathew Inwoode3807372018-08-10 09:51:03 +010042 @UnsupportedAppUsage
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040043 private final String pkg;
Mathew Inwoode3807372018-08-10 09:51:03 +010044 @UnsupportedAppUsage
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040045 private final int id;
Mathew Inwood31755f92018-12-20 13:53:36 +000046 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040047 private final String tag;
John Spurlocka4294292014-03-24 18:02:32 -040048 private final String key;
Julia Reynoldse46bb372016-03-17 11:05:58 -040049 private String groupKey;
50 private String overrideGroupKey;
Daniel Sandler5feceeb2013-03-22 18:29:23 -070051
Mathew Inwoode3807372018-08-10 09:51:03 +010052 @UnsupportedAppUsage
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040053 private final int uid;
Christoph Studer8fd7f1e2014-04-11 17:35:05 -040054 private final String opPkg;
Mathew Inwood31755f92018-12-20 13:53:36 +000055 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040056 private final int initialPid;
Mathew Inwood31755f92018-12-20 13:53:36 +000057 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040058 private final Notification notification;
Mathew Inwood31755f92018-12-20 13:53:36 +000059 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040060 private final UserHandle user;
Mathew Inwood31755f92018-12-20 13:53:36 +000061 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -040062 private final long postTime;
Jeff Sharkey6d515712012-09-20 16:06:08 -070063
Dan Sandler68079d52015-07-22 10:45:30 -040064 private Context mContext; // used for inflation & icon expansion
Daniel Sandler5feceeb2013-03-22 18:29:23 -070065
Eyal Posenera9cf9c72018-12-18 16:23:54 +020066 // Contains the basic logging data of the notification.
67 private LogMaker mLogMaker;
68
Daniel Sandler5feceeb2013-03-22 18:29:23 -070069 /** @hide */
Julia Reynolds924eed12017-01-19 09:52:07 -050070 public StatusBarNotification(String pkg, String opPkg, int id,
Julia Reynolds423b9fc2016-11-09 09:51:08 -050071 String tag, int uid, int initialPid, Notification notification, UserHandle user,
72 String overrideGroupKey, long postTime) {
Julia Reynoldse46bb372016-03-17 11:05:58 -040073 if (pkg == null) throw new NullPointerException();
74 if (notification == null) throw new NullPointerException();
75
76 this.pkg = pkg;
77 this.opPkg = opPkg;
78 this.id = id;
79 this.tag = tag;
80 this.uid = uid;
81 this.initialPid = initialPid;
82 this.notification = notification;
83 this.user = user;
84 this.postTime = postTime;
85 this.overrideGroupKey = overrideGroupKey;
86 this.key = key();
87 this.groupKey = groupKey();
88 }
89
Julia Reynoldsa11d0b12017-02-16 15:01:36 -050090 /**
91 * @deprecated Non-system apps should not need to create StatusBarNotifications.
92 */
Julia Reynolds423b9fc2016-11-09 09:51:08 -050093 @Deprecated
Christoph Studer8fd7f1e2014-04-11 17:35:05 -040094 public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid,
Daniel Sandlerfde19b12013-01-17 00:21:05 -050095 int initialPid, int score, Notification notification, UserHandle user,
96 long postTime) {
Joe Onorato18e69df2010-05-17 22:26:12 -070097 if (pkg == null) throw new NullPointerException();
98 if (notification == null) throw new NullPointerException();
99
100 this.pkg = pkg;
Christoph Studer8fd7f1e2014-04-11 17:35:05 -0400101 this.opPkg = opPkg;
Joe Onorato18e69df2010-05-17 22:26:12 -0700102 this.id = id;
103 this.tag = tag;
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700104 this.uid = uid;
105 this.initialPid = initialPid;
Joe Onorato18e69df2010-05-17 22:26:12 -0700106 this.notification = notification;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700107 this.user = user;
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500108 this.postTime = postTime;
John Spurlocka4294292014-03-24 18:02:32 -0400109 this.key = key();
Chris Wren1031c972014-07-23 13:11:45 +0000110 this.groupKey = groupKey();
Joe Onorato18e69df2010-05-17 22:26:12 -0700111 }
112
113 public StatusBarNotification(Parcel in) {
Joe Onorato18e69df2010-05-17 22:26:12 -0700114 this.pkg = in.readString();
Christoph Studer8fd7f1e2014-04-11 17:35:05 -0400115 this.opPkg = in.readString();
Joe Onorato18e69df2010-05-17 22:26:12 -0700116 this.id = in.readInt();
117 if (in.readInt() != 0) {
118 this.tag = in.readString();
119 } else {
120 this.tag = null;
121 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700122 this.uid = in.readInt();
123 this.initialPid = in.readInt();
Joe Onorato18e69df2010-05-17 22:26:12 -0700124 this.notification = new Notification(in);
Jeff Sharkey6d515712012-09-20 16:06:08 -0700125 this.user = UserHandle.readFromParcel(in);
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500126 this.postTime = in.readLong();
Julia Reynoldse46bb372016-03-17 11:05:58 -0400127 if (in.readInt() != 0) {
128 this.overrideGroupKey = in.readString();
129 } else {
130 this.overrideGroupKey = null;
131 }
John Spurlocka4294292014-03-24 18:02:32 -0400132 this.key = key();
Chris Wren1031c972014-07-23 13:11:45 +0000133 this.groupKey = groupKey();
John Spurlocka4294292014-03-24 18:02:32 -0400134 }
135
136 private String key() {
Julia Reynoldse46bb372016-03-17 11:05:58 -0400137 String sbnKey = user.getIdentifier() + "|" + pkg + "|" + id + "|" + tag + "|" + uid;
138 if (overrideGroupKey != null && getNotification().isGroupSummary()) {
139 sbnKey = sbnKey + "|" + overrideGroupKey;
140 }
141 return sbnKey;
Joe Onorato18e69df2010-05-17 22:26:12 -0700142 }
143
Chris Wren1031c972014-07-23 13:11:45 +0000144 private String groupKey() {
Julia Reynoldse46bb372016-03-17 11:05:58 -0400145 if (overrideGroupKey != null) {
146 return user.getIdentifier() + "|" + pkg + "|" + "g:" + overrideGroupKey;
147 }
Chris Wren1031c972014-07-23 13:11:45 +0000148 final String group = getNotification().getGroup();
149 final String sortKey = getNotification().getSortKey();
150 if (group == null && sortKey == null) {
151 // a group of one
152 return key;
153 }
154 return user.getIdentifier() + "|" + pkg + "|" +
155 (group == null
Julia Reynoldsbad42972017-04-25 13:52:49 -0400156 ? "c:" + notification.getChannelId()
Chris Wren1031c972014-07-23 13:11:45 +0000157 : "g:" + group);
158 }
159
Julia Reynoldse46bb372016-03-17 11:05:58 -0400160 /**
161 * Returns true if this notification is part of a group.
162 */
163 public boolean isGroup() {
Chris Wren8a1638f2016-05-02 16:19:14 -0400164 if (overrideGroupKey != null || isAppGroup()) {
165 return true;
166 }
167 return false;
168 }
169
170 /**
171 * Returns true if application asked that this notification be part of a group.
172 * @hide
173 */
174 public boolean isAppGroup() {
175 if (getNotification().getGroup() != null || getNotification().getSortKey() != null) {
Julia Reynoldse46bb372016-03-17 11:05:58 -0400176 return true;
177 }
178 return false;
179 }
180
Joe Onorato18e69df2010-05-17 22:26:12 -0700181 public void writeToParcel(Parcel out, int flags) {
182 out.writeString(this.pkg);
Christoph Studer8fd7f1e2014-04-11 17:35:05 -0400183 out.writeString(this.opPkg);
Joe Onorato18e69df2010-05-17 22:26:12 -0700184 out.writeInt(this.id);
185 if (this.tag != null) {
186 out.writeInt(1);
187 out.writeString(this.tag);
188 } else {
189 out.writeInt(0);
190 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -0700191 out.writeInt(this.uid);
192 out.writeInt(this.initialPid);
Joe Onorato18e69df2010-05-17 22:26:12 -0700193 this.notification.writeToParcel(out, flags);
Jeff Sharkey6d515712012-09-20 16:06:08 -0700194 user.writeToParcel(out, flags);
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500195
196 out.writeLong(this.postTime);
Julia Reynoldse46bb372016-03-17 11:05:58 -0400197 if (this.overrideGroupKey != null) {
198 out.writeInt(1);
199 out.writeString(this.overrideGroupKey);
200 } else {
201 out.writeInt(0);
202 }
Joe Onorato18e69df2010-05-17 22:26:12 -0700203 }
204
205 public int describeContents() {
206 return 0;
207 }
208
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700209 public static final @android.annotation.NonNull Parcelable.Creator<StatusBarNotification> CREATOR
Joe Onorato18e69df2010-05-17 22:26:12 -0700210 = new Parcelable.Creator<StatusBarNotification>()
211 {
212 public StatusBarNotification createFromParcel(Parcel parcel)
213 {
214 return new StatusBarNotification(parcel);
215 }
216
217 public StatusBarNotification[] newArray(int size)
218 {
219 return new StatusBarNotification[size];
220 }
221 };
222
Daniel Sandler1a497d32013-04-18 14:52:45 -0400223 /**
224 * @hide
225 */
226 public StatusBarNotification cloneLight() {
227 final Notification no = new Notification();
228 this.notification.cloneInto(no, false); // light copy
Julia Reynolds924eed12017-01-19 09:52:07 -0500229 return new StatusBarNotification(this.pkg, this.opPkg,
Daniel Sandler1a497d32013-04-18 14:52:45 -0400230 this.id, this.tag, this.uid, this.initialPid,
Julia Reynoldse46bb372016-03-17 11:05:58 -0400231 no, this.user, this.overrideGroupKey, this.postTime);
Daniel Sandler1a497d32013-04-18 14:52:45 -0400232 }
233
Jeff Sharkey6d515712012-09-20 16:06:08 -0700234 @Override
Joe Onorato18e69df2010-05-17 22:26:12 -0700235 public StatusBarNotification clone() {
Julia Reynolds924eed12017-01-19 09:52:07 -0500236 return new StatusBarNotification(this.pkg, this.opPkg,
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500237 this.id, this.tag, this.uid, this.initialPid,
Julia Reynoldse46bb372016-03-17 11:05:58 -0400238 this.notification.clone(), this.user, this.overrideGroupKey, this.postTime);
Joe Onorato18e69df2010-05-17 22:26:12 -0700239 }
240
Jeff Sharkey6d515712012-09-20 16:06:08 -0700241 @Override
Joe Onorato18e69df2010-05-17 22:26:12 -0700242 public String toString() {
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500243 return String.format(
Julia Reynoldse46bb372016-03-17 11:05:58 -0400244 "StatusBarNotification(pkg=%s user=%s id=%d tag=%s key=%s: %s)",
Daniel Sandlerfde19b12013-01-17 00:21:05 -0500245 this.pkg, this.user, this.id, this.tag,
Julia Reynoldse46bb372016-03-17 11:05:58 -0400246 this.key, this.notification);
Joe Onorato18e69df2010-05-17 22:26:12 -0700247 }
248
Daniel Sandler5feceeb2013-03-22 18:29:23 -0700249 /** Convenience method to check the notification's flags for
250 * {@link Notification#FLAG_ONGOING_EVENT}.
251 */
Joe Onoratoe345fff2010-05-23 15:18:27 -0400252 public boolean isOngoing() {
253 return (notification.flags & Notification.FLAG_ONGOING_EVENT) != 0;
254 }
255
Daniel Sandler5feceeb2013-03-22 18:29:23 -0700256 /** Convenience method to check the notification's flags for
257 * either {@link Notification#FLAG_ONGOING_EVENT} or
258 * {@link Notification#FLAG_NO_CLEAR}.
259 */
Joe Onorato5dd11692010-09-27 15:34:04 -0700260 public boolean isClearable() {
261 return ((notification.flags & Notification.FLAG_ONGOING_EVENT) == 0)
262 && ((notification.flags & Notification.FLAG_NO_CLEAR) == 0);
263 }
Daniel Sandlerb9301c32012-08-14 15:08:24 -0400264
Kenny Guya263e4e2014-03-03 18:24:03 +0000265 /**
Julia Reynoldsd5261e12016-12-19 14:14:25 -0500266 * Returns a userid for whom this notification is intended.
Kenny Guya263e4e2014-03-03 18:24:03 +0000267 *
268 * @deprecated Use {@link #getUser()} instead.
269 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -0700270 @Deprecated
Daniel Sandlerb9301c32012-08-14 15:08:24 -0400271 public int getUserId() {
Dianne Hackborn50cdf7c32012-09-23 17:08:57 -0700272 return this.user.getIdentifier();
Daniel Sandlerb9301c32012-08-14 15:08:24 -0400273 }
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400274
Julia Reynoldsa7ba45a2018-08-29 09:07:52 -0400275 /** The package that the notification belongs to. */
Daniel Sandler4f91efd2013-04-25 16:38:41 -0400276 public String getPackageName() {
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400277 return pkg;
278 }
279
Scott Main265103202013-05-22 19:00:09 -0700280 /** The id supplied to {@link android.app.NotificationManager#notify(int,Notification)}. */
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400281 public int getId() {
282 return id;
283 }
284
Scott Main265103202013-05-22 19:00:09 -0700285 /** The tag supplied to {@link android.app.NotificationManager#notify(int,Notification)},
286 * or null if no tag was specified. */
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400287 public String getTag() {
288 return tag;
289 }
290
Julia Reynoldsa7ba45a2018-08-29 09:07:52 -0400291 /**
292 * The notifying app's ({@link #getPackageName()}'s) uid.
293 */
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400294 public int getUid() {
295 return uid;
296 }
297
Julia Reynoldsa7ba45a2018-08-29 09:07:52 -0400298 /** The package that posted the notification.
299 *<p>
300 * Might be different from {@link #getPackageName()} if the app owning the notification has
301 * a {@link NotificationManager#setNotificationDelegate(String) notification delegate}.
302 */
Julia Reynoldscbc45e72019-03-07 12:31:52 -0500303 public @NonNull String getOpPkg() {
Christoph Studer8fd7f1e2014-04-11 17:35:05 -0400304 return opPkg;
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400305 }
306
307 /** @hide */
Mathew Inwoode3807372018-08-10 09:51:03 +0100308 @UnsupportedAppUsage
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400309 public int getInitialPid() {
310 return initialPid;
311 }
312
313 /** The {@link android.app.Notification} supplied to
Scott Main265103202013-05-22 19:00:09 -0700314 * {@link android.app.NotificationManager#notify(int,Notification)}. */
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400315 public Notification getNotification() {
316 return notification;
317 }
318
319 /**
320 * The {@link android.os.UserHandle} for whom this notification is intended.
Daniel Sandlere6f7f2e2013-04-25 15:44:16 -0400321 */
322 public UserHandle getUser() {
323 return user;
324 }
325
326 /** The time (in {@link System#currentTimeMillis} time) the notification was posted,
327 * which may be different than {@link android.app.Notification#when}.
328 */
329 public long getPostTime() {
330 return postTime;
331 }
332
John Spurlocka4294292014-03-24 18:02:32 -0400333 /**
334 * A unique instance key for this notification record.
335 */
336 public String getKey() {
337 return key;
338 }
Chris Wren1031c972014-07-23 13:11:45 +0000339
340 /**
341 * A key that indicates the group with which this message ranks.
342 */
343 public String getGroupKey() {
344 return groupKey;
345 }
Dan Sandler68079d52015-07-22 10:45:30 -0400346
347 /**
Chris Wrenb3921792017-06-01 13:34:46 -0400348 * The ID passed to setGroup(), or the override, or null.
349 * @hide
350 */
351 public String getGroup() {
352 if (overrideGroupKey != null) {
353 return overrideGroupKey;
354 }
355 return getNotification().getGroup();
356 }
357
358 /**
Julia Reynoldse46bb372016-03-17 11:05:58 -0400359 * Sets the override group key.
360 */
361 public void setOverrideGroupKey(String overrideGroupKey) {
362 this.overrideGroupKey = overrideGroupKey;
363 groupKey = groupKey();
364 }
365
366 /**
367 * Returns the override group key.
368 */
369 public String getOverrideGroupKey() {
370 return overrideGroupKey;
371 }
372
373 /**
Dan Sandler68079d52015-07-22 10:45:30 -0400374 * @hide
375 */
Amin Shaikhc3f0b062019-02-12 19:00:17 -0500376 public void clearPackageContext() {
377 mContext = null;
378 }
379
380 /**
381 * @hide
382 */
Mathew Inwoode3807372018-08-10 09:51:03 +0100383 @UnsupportedAppUsage
Dan Sandler68079d52015-07-22 10:45:30 -0400384 public Context getPackageContext(Context context) {
385 if (mContext == null) {
386 try {
387 ApplicationInfo ai = context.getPackageManager()
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700388 .getApplicationInfoAsUser(pkg, PackageManager.MATCH_UNINSTALLED_PACKAGES,
389 getUserId());
Dan Sandler68079d52015-07-22 10:45:30 -0400390 mContext = context.createApplicationContext(ai,
391 Context.CONTEXT_RESTRICTED);
392 } catch (PackageManager.NameNotFoundException e) {
393 mContext = null;
394 }
395 }
396 if (mContext == null) {
397 mContext = context;
398 }
399 return mContext;
400 }
Eyal Posenera9cf9c72018-12-18 16:23:54 +0200401
402 /**
403 * Returns a LogMaker that contains all basic information of the notification.
404 * @hide
405 */
406 public LogMaker getLogMaker() {
407 if (mLogMaker == null) {
408 // Initialize fields that only change on update (so a new record).
409 mLogMaker = new LogMaker(MetricsEvent.VIEW_UNKNOWN)
410 .setPackageName(getPackageName())
411 .addTaggedData(MetricsEvent.NOTIFICATION_ID, getId())
412 .addTaggedData(MetricsEvent.NOTIFICATION_TAG, getTag())
413 .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_CHANNEL_ID, getChannelIdLogTag());
414 }
415 // Reset fields that can change between updates, or are used by multiple logs.
416 return mLogMaker
417 .clearCategory()
418 .clearType()
419 .clearSubtype()
420 .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_ID, getGroupLogTag())
421 .addTaggedData(MetricsEvent.FIELD_NOTIFICATION_GROUP_SUMMARY,
Will Brockman828427e2019-01-28 09:55:45 -0500422 getNotification().isGroupSummary() ? 1 : 0)
423 .addTaggedData(MetricsProto.MetricsEvent.FIELD_NOTIFICATION_CATEGORY,
424 getNotification().category);
Eyal Posenera9cf9c72018-12-18 16:23:54 +0200425 }
426
427 private String getGroupLogTag() {
428 return shortenTag(getGroup());
429 }
430
431 private String getChannelIdLogTag() {
432 if (notification.getChannelId() == null) {
433 return null;
434 }
435 return shortenTag(notification.getChannelId());
436 }
437
438 // Make logTag with max size MAX_LOG_TAG_LENGTH.
439 // For shorter or equal tags, returns the tag.
440 // For longer tags, truncate the tag and append a hash of the full tag to
441 // fill the maximum size.
442 private String shortenTag(String logTag) {
443 if (logTag == null || logTag.length() <= MAX_LOG_TAG_LENGTH) {
444 return logTag;
445 }
446 String hash = Integer.toHexString(logTag.hashCode());
447 return logTag.substring(0, MAX_LOG_TAG_LENGTH - hash.length() - 1) + "-"
448 + hash;
449 }
Joe Onorato18e69df2010-05-17 22:26:12 -0700450}