OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.webapk.lib.runtime_library; | 5 package org.chromium.webapk.lib.runtime_library; |
6 | 6 |
7 import android.app.Notification; | 7 import android.app.Notification; |
8 import android.app.NotificationManager; | 8 import android.app.NotificationManager; |
9 import android.app.PendingIntent; | |
10 import android.content.Context; | 9 import android.content.Context; |
11 import android.content.Intent; | |
12 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
13 import android.os.Binder; | 11 import android.os.Binder; |
14 import android.os.Bundle; | 12 import android.os.Bundle; |
15 import android.os.Parcel; | 13 import android.os.Parcel; |
16 import android.os.RemoteException; | 14 import android.os.RemoteException; |
17 import android.util.Log; | 15 import android.util.Log; |
18 | 16 |
19 import java.util.Arrays; | 17 import java.util.Arrays; |
20 import java.util.HashSet; | 18 import java.util.HashSet; |
21 import java.util.Set; | 19 import java.util.Set; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 mAuthorizedUids.add(callingUid); | 63 mAuthorizedUids.add(callingUid); |
66 } else { | 64 } else { |
67 throw new RemoteException("Unauthorized caller " + callingUid | 65 throw new RemoteException("Unauthorized caller " + callingUid |
68 + " does not match expected host=" + mExpectedHostPackag
e); | 66 + " does not match expected host=" + mExpectedHostPackag
e); |
69 } | 67 } |
70 } | 68 } |
71 return super.onTransact(arg0, arg1, arg2, arg3); | 69 return super.onTransact(arg0, arg1, arg2, arg3); |
72 } | 70 } |
73 | 71 |
74 @Override | 72 @Override |
75 public PendingIntent getBroadcastPendingIntent(int requestCode, Intent inten
t, int flags) { | |
76 return PendingIntent.getBroadcast( | |
77 mContext.getApplicationContext(), requestCode, intent, flags); | |
78 } | |
79 | |
80 @Override | |
81 public int getSmallIconId() { | 73 public int getSmallIconId() { |
82 return mAppIcon; | 74 return mAppIcon; |
83 } | 75 } |
84 | 76 |
85 @Override | 77 @Override |
86 public void displayNotification(String platformTag, int platformID, Notifica
tion notification) { | 78 public void displayNotification(String platformTag, int platformID, Notifica
tion notification) { |
87 getNotificationManager().notify(platformTag, platformID, notification); | 79 getNotificationManager().notify(platformTag, platformID, notification); |
88 } | 80 } |
89 | 81 |
90 @Override | 82 @Override |
91 public void closeNotification(String platformTag, int platformID) { | 83 public void closeNotification(String platformTag, int platformID) { |
92 getNotificationManager().cancel(platformTag, platformID); | 84 getNotificationManager().cancel(platformTag, platformID); |
93 } | 85 } |
94 | 86 |
95 private NotificationManager getNotificationManager() { | 87 private NotificationManager getNotificationManager() { |
96 return (NotificationManager) mContext.getSystemService(Context.NOTIFICAT
ION_SERVICE); | 88 return (NotificationManager) mContext.getSystemService(Context.NOTIFICAT
ION_SERVICE); |
97 } | 89 } |
98 } | 90 } |
OLD | NEW |