Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8af4d4ad authored by Meng Wang's avatar Meng Wang
Browse files

Use Parcelable CellIdentity instead of CellLocation in AIDL.

Currently CellLocation is passed over AIDL by manually
marshalling/unmarshalling to/from Bundle, and type info
is not preserved in the process.

Bug: 146092124
Test: make
Merged-In: I6225f100953a2ad354acaa261a774989926393ce
Change-Id: I6225f100953a2ad354acaa261a774989926393ce
parent db9335b8
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -8057,6 +8057,34 @@ package android.telephony {
    field public static final String CELL_BROADCAST_SERVICE_INTERFACE = "android.telephony.CellBroadcastService";
    field public static final String CELL_BROADCAST_SERVICE_INTERFACE = "android.telephony.CellBroadcastService";
  }
  }
  public abstract class CellIdentity implements android.os.Parcelable {
    method @NonNull public abstract android.telephony.CellLocation asCellLocation();
  }
  public final class CellIdentityCdma extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.cdma.CdmaCellLocation asCellLocation();
  }
  public final class CellIdentityGsm extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation();
  }
  public final class CellIdentityLte extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation();
  }
  public final class CellIdentityNr extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.CellLocation asCellLocation();
  }
  public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation();
  }
  public final class CellIdentityWcdma extends android.telephony.CellIdentity {
    method @NonNull public android.telephony.gsm.GsmCellLocation asCellLocation();
  }
  public final class DataFailCause {
  public final class DataFailCause {
    field public static final int ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219; // 0x8ab
    field public static final int ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219; // 0x8ab
    field public static final int ACCESS_BLOCK = 2087; // 0x827
    field public static final int ACCESS_BLOCK = 2087; // 0x827
+5 −3
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.os.Binder;
import android.os.Binder;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.HandlerExecutor;
import android.os.Looper;
import android.os.Looper;
@@ -984,8 +983,11 @@ public class PhoneStateListener {
                    () -> mExecutor.execute(() -> psl.onCallForwardingIndicatorChanged(cfi)));
                    () -> mExecutor.execute(() -> psl.onCallForwardingIndicatorChanged(cfi)));
        }
        }


        public void onCellLocationChanged(Bundle bundle) {
        public void onCellLocationChanged(CellIdentity cellIdentity) {
            CellLocation location = CellLocation.newFromBundle(bundle);
            // 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();
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;
            if (psl == null) return;


+6 −5
Original line number Original line Diff line number Diff line
@@ -22,9 +22,6 @@ import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.content.Context;
import android.content.Context;
import android.os.Binder;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.telephony.Annotation.CallState;
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
     * @hide
     */
     */
    public void notifyCellLocation(int subId, Bundle cellLocation) {
    public void notifyCellLocation(int subId, CellIdentity cellLocation) {
        try {
        try {
            sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
            sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
+3 −4
Original line number Original line Diff line number Diff line
@@ -16,8 +16,8 @@


package com.android.internal.telephony;
package com.android.internal.telephony;


import android.os.Bundle;
import android.telephony.CallAttributes;
import android.telephony.CallAttributes;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.CellInfo;
import android.telephony.DataConnectionRealTimeInfo;
import android.telephony.DataConnectionRealTimeInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhoneCapability;
@@ -37,8 +37,8 @@ oneway interface IPhoneStateListener {
    void onMessageWaitingIndicatorChanged(boolean mwi);
    void onMessageWaitingIndicatorChanged(boolean mwi);
    void onCallForwardingIndicatorChanged(boolean cfi);
    void onCallForwardingIndicatorChanged(boolean cfi);


    // we use bundle here instead of CellLocation so it can get the right subclass
    // Uses CellIdentity which is Parcelable here; will convert to CellLocation in client.
    void onCellLocationChanged(in Bundle location);
    void onCellLocationChanged(in CellIdentity location);
    void onCallStateChanged(int state, String incomingNumber);
    void onCallStateChanged(int state, String incomingNumber);
    void onDataConnectionStateChanged(int state, int networkType);
    void onDataConnectionStateChanged(int state, int networkType);
    void onDataActivity(int direction);
    void onDataActivity(int direction);
@@ -63,4 +63,3 @@ oneway interface IPhoneStateListener {
    void onCallDisconnectCauseChanged(in int disconnectCause, in int preciseDisconnectCause);
    void onCallDisconnectCauseChanged(in int disconnectCause, in int preciseDisconnectCause);
    void onImsCallDisconnectCauseChanged(in ImsReasonInfo imsReasonInfo);
    void onImsCallDisconnectCauseChanged(in ImsReasonInfo imsReasonInfo);
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@ package com.android.internal.telephony;
import android.content.Intent;
import android.content.Intent;
import android.net.LinkProperties;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.net.NetworkCapabilities;
import android.os.Bundle;
import android.telephony.CallQuality;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.CellInfo;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhoneCapability;
@@ -67,9 +67,9 @@ interface ITelephonyRegistry {
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void notifyDataConnectionFailed(String apnType);
    void notifyDataConnectionFailed(String apnType);
    void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
    void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
    @UnsupportedAppUsage(maxTargetSdk = 28)
    // Uses CellIdentity which is Parcelable here; will convert to CellLocation in client.
    void notifyCellLocation(in Bundle cellLocation);
    void notifyCellLocation(in CellIdentity cellLocation);
    void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
    void notifyCellLocationForSubscriber(in int subId, in CellIdentity cellLocation);
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void notifyCellInfo(in List<CellInfo> cellInfo);
    void notifyCellInfo(in List<CellInfo> cellInfo);
    void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
    void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
Loading