Use Bundle for inter-process message
The message sent from NetworkScanRequestTracker to TelephonyScanManager
might be across different process, so we have to wrap the List<CellInfo> into
Bundle because List<> is not parcelable.
Cherry-picked cleanly from:
https://googleplex-android-review.googlesource.com/#/c/2467157/
Test: Telephony sanity tests
Bug: 30954762
Merged-in: I77945b247530b85c0b82876d528549498a711550
Changg-Id: I77945b247530b85c0b82876d528549498a711550
(cherry picked from commit 5604943709)
Change-Id: Iec4043e611a8f58733a361ec9a52fc74e1c974d5
This commit is contained in:
@@ -20,15 +20,18 @@ import static com.android.internal.util.Preconditions.checkNotNull;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.android.internal.telephony.ITelephony;
|
||||
@@ -41,6 +44,9 @@ public final class TelephonyScanManager {
|
||||
|
||||
private static final String TAG = "TelephonyScanManager";
|
||||
|
||||
/** @hide */
|
||||
public static final String SCAN_RESULT_KEY = "scanResult";
|
||||
|
||||
/** @hide */
|
||||
public static final int CALLBACK_SCAN_RESULTS = 1;
|
||||
/** @hide */
|
||||
@@ -112,7 +118,13 @@ public final class TelephonyScanManager {
|
||||
switch (message.what) {
|
||||
case CALLBACK_SCAN_RESULTS:
|
||||
try {
|
||||
callback.onResults((List<CellInfo>) message.obj);
|
||||
final Bundle b = message.getData();
|
||||
final Parcelable[] parcelables = b.getParcelableArray(SCAN_RESULT_KEY);
|
||||
CellInfo[] ci = new CellInfo[parcelables.length];
|
||||
for (int i = 0; i < parcelables.length; i++) {
|
||||
ci[i] = (CellInfo) parcelables[i];
|
||||
}
|
||||
callback.onResults((List<CellInfo>) Arrays.asList(ci));
|
||||
} catch (Exception e) {
|
||||
Rlog.e(TAG, "Exception in networkscan callback onResults", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user