NotificationCompatJellybean.java 15.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
package android.support.v4.app;

import android.annotation.TargetApi;
import android.app.Notification;
import android.app.Notification.BigPictureStyle;
import android.app.Notification.BigTextStyle;
import android.app.Notification.Builder;
import android.app.Notification.InboxStyle;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.util.SparseArray;
import android.widget.RemoteViews;
import cm;
import cs;
import cw;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

@TargetApi(16)
@RequiresApi(16)
final class NotificationCompatJellybean
{
  private static final Object a = new Object();
  private static Field b;
  private static boolean c;
  private static final Object d = new Object();
  private static Class<?> e;
  private static Field f;
  private static Field g;
  private static Field h;
  private static Field i;
  private static boolean j;
  
  public static Bundle a(Notification.Builder paramBuilder, NotificationCompatBase.Action paramAction)
  {
    paramBuilder.addAction(paramAction.getIcon(), paramAction.getTitle(), paramAction.getActionIntent());
    paramBuilder = new Bundle(paramAction.getExtras());
    if (paramAction.getRemoteInputs() != null) {
      paramBuilder.putParcelableArray("android.support.remoteInputs", cw.a(paramAction.getRemoteInputs()));
    }
    paramBuilder.putBoolean("android.support.allowGeneratedReplies", paramAction.getAllowGeneratedReplies());
    return paramBuilder;
  }
  
  public static Bundle a(Notification paramNotification)
  {
    Object localObject1;
    Bundle localBundle;
    synchronized (a)
    {
      if (c) {
        return null;
      }
    }
  }
  
  public static NotificationCompatBase.Action a(Notification paramNotification, int paramInt, NotificationCompatBase.Action.Factory paramFactory, RemoteInputCompatBase.RemoteInput.Factory paramFactory1)
  {
    for (;;)
    {
      synchronized (d)
      {
        try
        {
          Object localObject2 = g(paramNotification)[paramInt];
          paramNotification = a(paramNotification);
          if (paramNotification != null)
          {
            paramNotification = paramNotification.getSparseParcelableArray("android.support.actionExtras");
            if (paramNotification != null)
            {
              paramNotification = (Bundle)paramNotification.get(paramInt);
              paramNotification = a(paramFactory, paramFactory1, g.getInt(localObject2), (CharSequence)h.get(localObject2), (PendingIntent)i.get(localObject2), paramNotification);
              return paramNotification;
            }
          }
        }
        catch (IllegalAccessException paramNotification)
        {
          Log.e("NotificationCompat", "Unable to access notification actions", paramNotification);
          j = true;
          return null;
        }
      }
      paramNotification = null;
    }
  }
  
  public static NotificationCompatBase.Action a(NotificationCompatBase.Action.Factory paramFactory, RemoteInputCompatBase.RemoteInput.Factory paramFactory1, int paramInt, CharSequence paramCharSequence, PendingIntent paramPendingIntent, Bundle paramBundle)
  {
    RemoteInputCompatBase.RemoteInput[] arrayOfRemoteInput = null;
    boolean bool = false;
    if (paramBundle != null)
    {
      arrayOfRemoteInput = cw.a(cm.a(paramBundle, "android.support.remoteInputs"), paramFactory1);
      bool = paramBundle.getBoolean("android.support.allowGeneratedReplies");
    }
    return paramFactory.build(paramInt, paramCharSequence, paramPendingIntent, paramBundle, arrayOfRemoteInput, bool);
  }
  
  public static SparseArray<Bundle> a(List<Bundle> paramList)
  {
    Object localObject1 = null;
    int m = paramList.size();
    int k = 0;
    while (k < m)
    {
      Bundle localBundle = (Bundle)paramList.get(k);
      Object localObject2 = localObject1;
      if (localBundle != null)
      {
        localObject2 = localObject1;
        if (localObject1 == null) {
          localObject2 = new SparseArray();
        }
        ((SparseArray)localObject2).put(k, localBundle);
      }
      k += 1;
      localObject1 = localObject2;
    }
    return (SparseArray<Bundle>)localObject1;
  }
  
  public static ArrayList<Parcelable> a(NotificationCompatBase.Action[] paramArrayOfAction)
  {
    Object localObject;
    if (paramArrayOfAction == null)
    {
      localObject = null;
      return (ArrayList<Parcelable>)localObject;
    }
    ArrayList localArrayList = new ArrayList(paramArrayOfAction.length);
    int m = paramArrayOfAction.length;
    int k = 0;
    for (;;)
    {
      localObject = localArrayList;
      if (k >= m) {
        break;
      }
      localObject = paramArrayOfAction[k];
      Bundle localBundle = new Bundle();
      localBundle.putInt("icon", ((NotificationCompatBase.Action)localObject).getIcon());
      localBundle.putCharSequence("title", ((NotificationCompatBase.Action)localObject).getTitle());
      localBundle.putParcelable("actionIntent", ((NotificationCompatBase.Action)localObject).getActionIntent());
      localBundle.putBundle("extras", ((NotificationCompatBase.Action)localObject).getExtras());
      localBundle.putParcelableArray("remoteInputs", cw.a(((NotificationCompatBase.Action)localObject).getRemoteInputs()));
      localArrayList.add(localBundle);
      k += 1;
    }
  }
  
  public static void a(NotificationBuilderWithBuilderAccessor paramNotificationBuilderWithBuilderAccessor, CharSequence paramCharSequence1, boolean paramBoolean1, CharSequence paramCharSequence2, Bitmap paramBitmap1, Bitmap paramBitmap2, boolean paramBoolean2)
  {
    paramNotificationBuilderWithBuilderAccessor = new Notification.BigPictureStyle(paramNotificationBuilderWithBuilderAccessor.getBuilder()).setBigContentTitle(paramCharSequence1).bigPicture(paramBitmap1);
    if (paramBoolean2) {
      paramNotificationBuilderWithBuilderAccessor.bigLargeIcon(paramBitmap2);
    }
    if (paramBoolean1) {
      paramNotificationBuilderWithBuilderAccessor.setSummaryText(paramCharSequence2);
    }
  }
  
  public static void a(NotificationBuilderWithBuilderAccessor paramNotificationBuilderWithBuilderAccessor, CharSequence paramCharSequence1, boolean paramBoolean, CharSequence paramCharSequence2, CharSequence paramCharSequence3)
  {
    paramNotificationBuilderWithBuilderAccessor = new Notification.BigTextStyle(paramNotificationBuilderWithBuilderAccessor.getBuilder()).setBigContentTitle(paramCharSequence1).bigText(paramCharSequence3);
    if (paramBoolean) {
      paramNotificationBuilderWithBuilderAccessor.setSummaryText(paramCharSequence2);
    }
  }
  
  public static void a(NotificationBuilderWithBuilderAccessor paramNotificationBuilderWithBuilderAccessor, CharSequence paramCharSequence1, boolean paramBoolean, CharSequence paramCharSequence2, ArrayList<CharSequence> paramArrayList)
  {
    paramNotificationBuilderWithBuilderAccessor = new Notification.InboxStyle(paramNotificationBuilderWithBuilderAccessor.getBuilder()).setBigContentTitle(paramCharSequence1);
    if (paramBoolean) {
      paramNotificationBuilderWithBuilderAccessor.setSummaryText(paramCharSequence2);
    }
    paramCharSequence1 = paramArrayList.iterator();
    while (paramCharSequence1.hasNext()) {
      paramNotificationBuilderWithBuilderAccessor.addLine((CharSequence)paramCharSequence1.next());
    }
  }
  
  private static boolean a()
  {
    if (j) {}
    for (;;)
    {
      return false;
      try
      {
        if (f == null)
        {
          Object localObject = Class.forName("android.app.Notification$Action");
          e = (Class)localObject;
          g = ((Class)localObject).getDeclaredField("icon");
          h = e.getDeclaredField("title");
          i = e.getDeclaredField("actionIntent");
          localObject = Notification.class.getDeclaredField("actions");
          f = (Field)localObject;
          ((Field)localObject).setAccessible(true);
        }
        if (j) {
          continue;
        }
        return true;
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        for (;;)
        {
          Log.e("NotificationCompat", "Unable to access notification actions", localClassNotFoundException);
          j = true;
        }
      }
      catch (NoSuchFieldException localNoSuchFieldException)
      {
        for (;;)
        {
          Log.e("NotificationCompat", "Unable to access notification actions", localNoSuchFieldException);
          j = true;
        }
      }
    }
  }
  
  public static NotificationCompatBase.Action[] a(ArrayList<Parcelable> paramArrayList, NotificationCompatBase.Action.Factory paramFactory, RemoteInputCompatBase.RemoteInput.Factory paramFactory1)
  {
    if (paramArrayList == null) {
      return null;
    }
    NotificationCompatBase.Action[] arrayOfAction = paramFactory.newArray(paramArrayList.size());
    int k = 0;
    while (k < arrayOfAction.length)
    {
      Bundle localBundle = (Bundle)paramArrayList.get(k);
      arrayOfAction[k] = paramFactory.build(localBundle.getInt("icon"), localBundle.getCharSequence("title"), (PendingIntent)localBundle.getParcelable("actionIntent"), localBundle.getBundle("extras"), cw.a(cm.a(localBundle, "remoteInputs"), paramFactory1), localBundle.getBoolean("allowGeneratedReplies"));
      k += 1;
    }
    return arrayOfAction;
  }
  
  public static int b(Notification paramNotification)
  {
    for (;;)
    {
      synchronized (d)
      {
        paramNotification = g(paramNotification);
        if (paramNotification != null)
        {
          k = paramNotification.length;
          return k;
        }
      }
      int k = 0;
    }
  }
  
  public static boolean c(Notification paramNotification)
  {
    return a(paramNotification).getBoolean("android.support.localOnly");
  }
  
  public static String d(Notification paramNotification)
  {
    return a(paramNotification).getString("android.support.groupKey");
  }
  
  public static boolean e(Notification paramNotification)
  {
    return a(paramNotification).getBoolean("android.support.isGroupSummary");
  }
  
  public static String f(Notification paramNotification)
  {
    return a(paramNotification).getString("android.support.sortKey");
  }
  
  private static Object[] g(Notification paramNotification)
  {
    synchronized (d)
    {
      if (!a()) {
        return null;
      }
    }
    return null;
  }
  
  public static class Builder
    implements NotificationBuilderWithBuilderAccessor, cs
  {
    private Notification.Builder a;
    private final Bundle b;
    private List<Bundle> c = new ArrayList();
    private RemoteViews d;
    private RemoteViews e;
    
    public Builder(Context paramContext, Notification paramNotification, CharSequence paramCharSequence1, CharSequence paramCharSequence2, CharSequence paramCharSequence3, RemoteViews paramRemoteViews1, int paramInt1, PendingIntent paramPendingIntent1, PendingIntent paramPendingIntent2, Bitmap paramBitmap, int paramInt2, int paramInt3, boolean paramBoolean1, boolean paramBoolean2, int paramInt4, CharSequence paramCharSequence4, boolean paramBoolean3, Bundle paramBundle, String paramString1, boolean paramBoolean4, String paramString2, RemoteViews paramRemoteViews2, RemoteViews paramRemoteViews3)
    {
      paramContext = new Notification.Builder(paramContext).setWhen(paramNotification.when).setSmallIcon(paramNotification.icon, paramNotification.iconLevel).setContent(paramNotification.contentView).setTicker(paramNotification.tickerText, paramRemoteViews1).setSound(paramNotification.sound, paramNotification.audioStreamType).setVibrate(paramNotification.vibrate).setLights(paramNotification.ledARGB, paramNotification.ledOnMS, paramNotification.ledOffMS);
      boolean bool;
      if ((paramNotification.flags & 0x2) != 0)
      {
        bool = true;
        paramContext = paramContext.setOngoing(bool);
        if ((paramNotification.flags & 0x8) == 0) {
          break label349;
        }
        bool = true;
        label123:
        paramContext = paramContext.setOnlyAlertOnce(bool);
        if ((paramNotification.flags & 0x10) == 0) {
          break label355;
        }
        bool = true;
        label143:
        paramContext = paramContext.setAutoCancel(bool).setDefaults(paramNotification.defaults).setContentTitle(paramCharSequence1).setContentText(paramCharSequence2).setSubText(paramCharSequence4).setContentInfo(paramCharSequence3).setContentIntent(paramPendingIntent1).setDeleteIntent(paramNotification.deleteIntent);
        if ((paramNotification.flags & 0x80) == 0) {
          break label361;
        }
        bool = true;
        label202:
        this.a = paramContext.setFullScreenIntent(paramPendingIntent2, bool).setLargeIcon(paramBitmap).setNumber(paramInt1).setUsesChronometer(paramBoolean2).setPriority(paramInt4).setProgress(paramInt2, paramInt3, paramBoolean1);
        this.b = new Bundle();
        if (paramBundle != null) {
          this.b.putAll(paramBundle);
        }
        if (paramBoolean3) {
          this.b.putBoolean("android.support.localOnly", true);
        }
        if (paramString1 != null)
        {
          this.b.putString("android.support.groupKey", paramString1);
          if (!paramBoolean4) {
            break label367;
          }
          this.b.putBoolean("android.support.isGroupSummary", true);
        }
      }
      for (;;)
      {
        if (paramString2 != null) {
          this.b.putString("android.support.sortKey", paramString2);
        }
        this.d = paramRemoteViews2;
        this.e = paramRemoteViews3;
        return;
        bool = false;
        break;
        label349:
        bool = false;
        break label123;
        label355:
        bool = false;
        break label143;
        label361:
        bool = false;
        break label202;
        label367:
        this.b.putBoolean("android.support.useSideChannel", true);
      }
    }
    
    public void addAction(NotificationCompatBase.Action paramAction)
    {
      this.c.add(NotificationCompatJellybean.a(this.a, paramAction));
    }
    
    public Notification build()
    {
      Notification localNotification = this.a.build();
      Object localObject = NotificationCompatJellybean.a(localNotification);
      Bundle localBundle = new Bundle(this.b);
      Iterator localIterator = this.b.keySet().iterator();
      while (localIterator.hasNext())
      {
        String str = (String)localIterator.next();
        if (((Bundle)localObject).containsKey(str)) {
          localBundle.remove(str);
        }
      }
      ((Bundle)localObject).putAll(localBundle);
      localObject = NotificationCompatJellybean.a(this.c);
      if (localObject != null) {
        NotificationCompatJellybean.a(localNotification).putSparseParcelableArray("android.support.actionExtras", (SparseArray)localObject);
      }
      if (this.d != null) {
        localNotification.contentView = this.d;
      }
      if (this.e != null) {
        localNotification.bigContentView = this.e;
      }
      return localNotification;
    }
    
    public Notification.Builder getBuilder()
    {
      return this.a;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/app/NotificationCompatJellybean.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */