Merge "Use Parcelable CellIdentity instead of CellLocation in AIDL."

This commit is contained in:
Meng Wang
2020-01-10 04:25:45 +00:00
committed by Gerrit Code Review
15 changed files with 90 additions and 61 deletions

View File

@@ -24,7 +24,6 @@ import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Looper;
@@ -984,8 +983,11 @@ public class PhoneStateListener {
() -> mExecutor.execute(() -> psl.onCallForwardingIndicatorChanged(cfi)));
}
public void onCellLocationChanged(Bundle bundle) {
CellLocation location = CellLocation.newFromBundle(bundle);
public void onCellLocationChanged(CellIdentity cellIdentity) {
// There is no system/public API to create an CellIdentity in system server,
// so the server pass a null to indicate an empty initial location.
CellLocation location =
cellIdentity == null ? CellLocation.getEmpty() : cellIdentity.asCellLocation();
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
if (psl == null) return;

View File

@@ -22,9 +22,6 @@ import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.content.Context;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.Annotation.CallState;
@@ -642,10 +639,14 @@ public class TelephonyRegistryManager {
}
/**
* TODO change from bundle to CellLocation?
* Notify {@link android.telephony.CellLocation} changed.
*
* <p>To be compatible with {@link TelephonyRegistry}, use {@link CellIdentity} which is
* parcelable, and convert to CellLocation in client code.
*
* @hide
*/
public void notifyCellLocation(int subId, Bundle cellLocation) {
public void notifyCellLocation(int subId, CellIdentity cellLocation) {
try {
sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
} catch (RemoteException ex) {