Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -77,6 +78,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {

public static final String KEY_ERROR = "Error";
public static final String KEY_USER_RECOVERY_INTENT = "userRecoveryIntent";
public static final String KEY_USER_RECOVERY_PENDING_INTENT = "userRecoveryPendingIntent";

private final Context context;

Expand Down Expand Up @@ -171,16 +173,18 @@ public Bundle getTokenWithAccount(Account account, String scope, Bundle extras)
} catch (Exception e) {
Log.w(TAG, "Can't decode consent data: ", e);
}
PendingIntent pendingIntent = PendingIntentCompat.getActivity(context, 0, i, 0, false);
if (notify) {
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(packageName.hashCode(), new NotificationCompat.Builder(context)
.setContentIntent(PendingIntentCompat.getActivity(context, 0, i, 0, false))
.setContentIntent(pendingIntent)
.setContentTitle(context.getString(R.string.auth_notification_title))
.setContentText(context.getString(R.string.auth_notification_content, getPackageLabel(packageName, context.getPackageManager())))
.setSmallIcon(android.R.drawable.stat_notify_error)
.build());
}
result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
result.putParcelable(KEY_USER_RECOVERY_PENDING_INTENT, pendingIntent);
}
} catch (IOException e) {
Log.w(TAG, e);
Expand Down