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

Commit 1bf6ec2f authored by fionaxu's avatar fionaxu
Browse files

cold sim clean up

- add a new field: provisioningNotificationEnabled from NetworkMisc. set
  to false if we want to hide "sign in" notification and placed
  carrier-specific notification instead. it is set on connect, once set,
  it is carrier-app's responsibility to post new UI to users
- rework on the interaction between carrier app and framework
- code cleanup
- unit test support

Bug: 28567303
Change-Id: Ic84db7ffbb920d15344717f104496d3cb82e1a85
parent a48f9cb7
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -51,6 +51,15 @@ public class NetworkMisc implements Parcelable {
     */
    public boolean acceptUnvalidated;

    /**
     * Set to avoid surfacing the "Sign in to network" notification.
     * if carrier receivers/apps are registered to handle the carrier-specific provisioning
     * procedure, a carrier specific provisioning notification will be placed.
     * only one notification should be displayed. This field is set based on
     * which notification should be used for provisioning.
     */
    public boolean provisioningNotificationDisabled;

    /**
     * For mobile networks, this is the subscriber ID (such as IMSI).
     */
@@ -65,6 +74,7 @@ public class NetworkMisc implements Parcelable {
            explicitlySelected = nm.explicitlySelected;
            acceptUnvalidated = nm.acceptUnvalidated;
            subscriberId = nm.subscriberId;
            provisioningNotificationDisabled = nm.provisioningNotificationDisabled;
        }
    }

@@ -79,6 +89,7 @@ public class NetworkMisc implements Parcelable {
        out.writeInt(explicitlySelected ? 1 : 0);
        out.writeInt(acceptUnvalidated ? 1 : 0);
        out.writeString(subscriberId);
        out.writeInt(provisioningNotificationDisabled ? 1 : 0);
    }

    public static final Creator<NetworkMisc> CREATOR = new Creator<NetworkMisc>() {
@@ -89,6 +100,7 @@ public class NetworkMisc implements Parcelable {
            networkMisc.explicitlySelected = in.readInt() != 0;
            networkMisc.acceptUnvalidated = in.readInt() != 0;
            networkMisc.subscriberId = in.readString();
            networkMisc.provisioningNotificationDisabled = in.readInt() != 0;
            return networkMisc;
        }

+1 −1
Original line number Diff line number Diff line
@@ -810,7 +810,7 @@ public class NetworkControllerImpl extends BroadcastReceiver

    private SubscriptionInfo addSignalController(int id, int simSlotIndex) {
        SubscriptionInfo info = new SubscriptionInfo(id, "", simSlotIndex, "", "", 0, 0, "", 0,
                null, 0, 0, "", SubscriptionManager.SIM_PROVISIONED);
                null, 0, 0, "");
        mMobileSignalControllers.put(id, new MobileSignalController(mContext,
                mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info,
                mSubDefaults, mReceiverHandler.getLooper()));
+6 −3
Original line number Diff line number Diff line
@@ -2150,10 +2150,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
                            loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor");
                            break;
                        }
                        if (!nai.networkMisc.provisioningNotificationDisabled) {
                            setProvNotificationVisibleIntent(true, netId, NotificationType.SIGN_IN,
                                    nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(),
                                    (PendingIntent)msg.obj, nai.networkMisc.explicitlySelected);
                        }
                    }
                    break;
                }
            }
@@ -2553,6 +2555,7 @@ public class ConnectivityService extends IConnectivityManager.Stub

        PendingIntent pendingIntent = PendingIntent.getActivityAsUser(
                mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);

        setProvNotificationVisibleIntent(true, nai.network.netId, NotificationType.NO_INTERNET,
                nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), pendingIntent, true);
    }
+1 −2
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import com.android.internal.util.Protocol;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
import com.android.internal.util.WakeupMessage;
import com.android.server.connectivity.NetworkAgentInfo;

import java.io.IOException;
import java.net.HttpURLConnection;
+33 −13
Original line number Diff line number Diff line
@@ -662,18 +662,37 @@ public class CarrierConfigManager {
    public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";

    /**
     * If carriers require differentiate un-provisioned status: cold sim or out of credit sim
     * a package name and activity name can be provided to launch a supported carrier application
     * that check the sim provisioning status
     * The first element is the package name and the second element is the activity name
     * of the provisioning app
     * example:
     * <item>com.google.android.carrierPackageName</item>
     * <item>com.google.android.carrierPackageName.CarrierActivityName</item>
     * A list of component name of carrier signalling receivers which are interested in intent
     * android.intent.action.CARRIER_SIGNAL_REDIRECTED.
     * Example:
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameA</item>
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameB</item>
     * @hide
     */
     public static final String KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY =
            "sim_state_detection_carrier_app_string_array";
    public static final String KEY_SIGNAL_REDIRECTION_RECEIVER_STRING_ARRAY =
            "signal_redirection_receiver_string_array";

    /**
     * A list of component name of carrier signalling receivers which are interested in intent
     * android.intent.action.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED.
     * Example:
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameA</item>
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameB</item>
     * @hide
     */
    public static final String KEY_SIGNAL_DCFAILURE_RECEIVER_STRING_ARRAY =
            "signal_dcfailure_receiver_string_array";

    /**
     * A list of component name of carrier signalling receivers which are interested in intent
     * android.intent.action.CARRIER_SIGNAL_PCO_VALUE.
     * Example:
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameA</item>
     * <item>com.google.android.carrierPackageName/.CarrierSignalReceiverNameB</item>
     * @hide
     */
    public static final String KEY_SIGNAL_PCO_RECEIVER_STRING_ARRAY =
            "signal_pco_receiver_string_array";

    /**
     * Determines whether the carrier supports making non-emergency phone calls while the phone is
@@ -849,9 +868,10 @@ public class CarrierConfigManager {
        sDefaults.putBoolean(KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL, true);
        sDefaults.putBoolean(KEY_USE_RCS_PRESENCE_BOOL, false);

        // Used for Sim card State detection app
        sDefaults.putStringArray(KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY,
                null);
        // Carrier Signalling Receivers
        sDefaults.putStringArray(KEY_SIGNAL_REDIRECTION_RECEIVER_STRING_ARRAY, null);
        sDefaults.putStringArray(KEY_SIGNAL_DCFAILURE_RECEIVER_STRING_ARRAY, null);
        sDefaults.putStringArray(KEY_SIGNAL_PCO_RECEIVER_STRING_ARRAY, null);
    }

    /**
Loading