| 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.mojo.shell; | 5 package org.chromium.mojo.shell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.ServiceConnection; | 10 import android.content.ServiceConnection; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 @Override | 44 @Override |
| 45 protected void onNewIntent(Intent intent) { | 45 protected void onNewIntent(Intent intent) { |
| 46 super.onNewIntent(intent); | 46 super.onNewIntent(intent); |
| 47 mPendingIntents.add(intent); | 47 mPendingIntents.add(intent); |
| 48 } | 48 } |
| 49 | 49 |
| 50 @Override | 50 @Override |
| 51 public void onShellBound(ShellService shellService) { | 51 public void onShellBound(ShellService shellService) { |
| 52 mShellService = shellService; | 52 mShellService = shellService; |
| 53 finish(); | 53 finish(); |
| 54 Intent intent = new Intent(this, MojoShellActivity.class); | |
| 55 intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); | |
| 56 startActivity(intent); | |
| 57 while (!mPendingIntents.isEmpty()) { | 54 while (!mPendingIntents.isEmpty()) { |
| 58 Intent pendingIntent = mPendingIntents.remove(); | 55 Intent pendingIntent = mPendingIntents.remove(); |
| 59 sendNfcMessages(pendingIntent); | 56 sendNfcMessages(pendingIntent); |
| 60 } | 57 } |
| 61 unbindService(mShellServiceConnection); | 58 unbindService(mShellServiceConnection); |
| 62 } | 59 } |
| 63 | 60 |
| 64 @Override | 61 @Override |
| 65 public void onShellUnbound() { | 62 public void onShellUnbound() { |
| 66 mShellService = null; | 63 mShellService = null; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 NdefRecord[] records = msg.getRecords(); | 76 NdefRecord[] records = msg.getRecords(); |
| 80 for (int i = 0; i < (records.length - 1); i++) { | 77 for (int i = 0; i < (records.length - 1); i++) { |
| 81 byte[] payload = records[i].getPayload(); | 78 byte[] payload = records[i].getPayload(); |
| 82 if (payload != null) { | 79 if (payload != null) { |
| 83 nfcMessageSink.onNfcMessage(payload); | 80 nfcMessageSink.onNfcMessage(payload); |
| 84 } | 81 } |
| 85 } | 82 } |
| 86 nfcMessageSink.close(); | 83 nfcMessageSink.close(); |
| 87 } | 84 } |
| 88 } | 85 } |
| OLD | NEW |