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

Commit c9bad6ef authored by Nathan Harold's avatar Nathan Harold
Browse files

Use Empty List for Default PhysicalChannelConfig

If a caller registers to listen() for a physical
channel config message, the beavior is to immediately
trigger an unsol. In the case that a list hasn't been
sent from the modem, we should send a default empty
list rather than a null. This is the preferred
approach for Android APIs because it reduces the
reliance on null checks by callers.

Bug: 78536847
Test: ¯\_(ツ)_/¯
Change-Id: I9e59195f5d64264ab473b2fd7e4f7eb6446c4829
parent 336076b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mCallForwarding[i] =  false;
            mCellLocation[i] = new Bundle();
            mCellInfo.add(i, null);
            mPhysicalChannelConfigs.add(i, null);
            mPhysicalChannelConfigs.add(i, new ArrayList<PhysicalChannelConfig>());
        }

        // Note that location can be null for non-phone builds like
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.telephony;

import android.annotation.NonNull;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -578,7 +579,8 @@ public class PhoneStateListener {
     * @param configs List of the current {@link PhysicalChannelConfig}s
     * @hide
     */
    public void onPhysicalChannelConfigurationChanged(List<PhysicalChannelConfig> configs) {
    public void onPhysicalChannelConfigurationChanged(
            @NonNull List<PhysicalChannelConfig> configs) {
        // default implementation empty
    }