Loading src/java/com/android/internal/telephony/PhoneFactory.java +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.LocalLog; import com.android.internal.os.BackgroundThread; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.dataconnection.TelephonyNetworkFactory; import com.android.internal.telephony.euicc.EuiccCardController; import com.android.internal.telephony.euicc.EuiccController; import com.android.internal.telephony.ims.ImsResolver; import com.android.internal.telephony.imsphone.ImsPhone; Loading Loading @@ -73,6 +74,7 @@ public class PhoneFactory { static private UiccController sUiccController; private static IntentBroadcaster sIntentBroadcaster; private static @Nullable EuiccController sEuiccController; private static @Nullable EuiccCardController sEuiccCardController; static private CommandsInterface sCommandsInterface = null; static private SubscriptionInfoUpdater sSubInfoRecordUpdater = null; Loading Loading @@ -141,6 +143,7 @@ public class PhoneFactory { if (context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TELEPHONY_EUICC)) { sEuiccController = EuiccController.init(context); sEuiccCardController = EuiccCardController.init(context); } /* In case of multi SIM mode two instances of Phone, RIL are created, Loading Loading @@ -467,6 +470,7 @@ public class PhoneFactory { pw.increaseIndent(); try { sEuiccController.dump(fd, pw, args); sEuiccCardController.dump(fd, pw, args); } catch (Exception e) { e.printStackTrace(); } Loading src/java/com/android/internal/telephony/euicc/EuiccCardController.java 0 → 100644 +102 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.euicc; import android.app.AppOpsManager; import android.content.Context; import android.content.pm.ComponentInfo; import android.os.Binder; import android.os.ServiceManager; import android.telephony.euicc.EuiccCardManager; import android.text.TextUtils; import android.util.Log; import java.io.FileDescriptor; import java.io.PrintWriter; /** Backing implementation of {@link EuiccCardManager}. */ public class EuiccCardController extends IEuiccCardController.Stub { private static final String TAG = "EuiccCardController"; private final Context mContext; private AppOpsManager mAppOps; private String mCallingPackage; private ComponentInfo mBestComponent; private static EuiccCardController sInstance; /** Initialize the instance. Should only be called once. */ public static EuiccCardController init(Context context) { synchronized (EuiccCardController.class) { if (sInstance == null) { sInstance = new EuiccCardController(context); } else { Log.wtf(TAG, "init() called multiple times! sInstance = " + sInstance); } } return sInstance; } /** Get an instance. Assumes one has already been initialized with {@link #init}. */ public static EuiccCardController get() { if (sInstance == null) { synchronized (EuiccCardController.class) { if (sInstance == null) { throw new IllegalStateException("get() called before init()"); } } } return sInstance; } private EuiccCardController(Context context) { mContext = context; mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); ServiceManager.addService("euicc_card_controller", this); } private void checkCallingPackage(String callingPackage) { // Check the caller is LPA. mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); mCallingPackage = callingPackage; mBestComponent = EuiccConnector.findBestComponent(mContext.getPackageManager()); if (mBestComponent == null || !TextUtils.equals(mCallingPackage, mBestComponent.packageName)) { throw new SecurityException("The calling package can only be LPA."); } } @Override public void getAllProfiles(String callingPackage, IGetAllProfilesCallback getProfilesCb) { checkCallingPackage(callingPackage); // TODO(b/38206971): Get EuiccCard instance from UiccController and call the API. } @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP"); final long token = Binder.clearCallingIdentity(); super.dump(fd, pw, args); // TODO(b/38206971): dump more information. pw.println("mCallingPackage=" + mCallingPackage); pw.println("mBestComponent=" + mBestComponent); Binder.restoreCallingIdentity(token); } } Loading
src/java/com/android/internal/telephony/PhoneFactory.java +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.LocalLog; import com.android.internal.os.BackgroundThread; import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager; import com.android.internal.telephony.dataconnection.TelephonyNetworkFactory; import com.android.internal.telephony.euicc.EuiccCardController; import com.android.internal.telephony.euicc.EuiccController; import com.android.internal.telephony.ims.ImsResolver; import com.android.internal.telephony.imsphone.ImsPhone; Loading Loading @@ -73,6 +74,7 @@ public class PhoneFactory { static private UiccController sUiccController; private static IntentBroadcaster sIntentBroadcaster; private static @Nullable EuiccController sEuiccController; private static @Nullable EuiccCardController sEuiccCardController; static private CommandsInterface sCommandsInterface = null; static private SubscriptionInfoUpdater sSubInfoRecordUpdater = null; Loading Loading @@ -141,6 +143,7 @@ public class PhoneFactory { if (context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TELEPHONY_EUICC)) { sEuiccController = EuiccController.init(context); sEuiccCardController = EuiccCardController.init(context); } /* In case of multi SIM mode two instances of Phone, RIL are created, Loading Loading @@ -467,6 +470,7 @@ public class PhoneFactory { pw.increaseIndent(); try { sEuiccController.dump(fd, pw, args); sEuiccCardController.dump(fd, pw, args); } catch (Exception e) { e.printStackTrace(); } Loading
src/java/com/android/internal/telephony/euicc/EuiccCardController.java 0 → 100644 +102 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.euicc; import android.app.AppOpsManager; import android.content.Context; import android.content.pm.ComponentInfo; import android.os.Binder; import android.os.ServiceManager; import android.telephony.euicc.EuiccCardManager; import android.text.TextUtils; import android.util.Log; import java.io.FileDescriptor; import java.io.PrintWriter; /** Backing implementation of {@link EuiccCardManager}. */ public class EuiccCardController extends IEuiccCardController.Stub { private static final String TAG = "EuiccCardController"; private final Context mContext; private AppOpsManager mAppOps; private String mCallingPackage; private ComponentInfo mBestComponent; private static EuiccCardController sInstance; /** Initialize the instance. Should only be called once. */ public static EuiccCardController init(Context context) { synchronized (EuiccCardController.class) { if (sInstance == null) { sInstance = new EuiccCardController(context); } else { Log.wtf(TAG, "init() called multiple times! sInstance = " + sInstance); } } return sInstance; } /** Get an instance. Assumes one has already been initialized with {@link #init}. */ public static EuiccCardController get() { if (sInstance == null) { synchronized (EuiccCardController.class) { if (sInstance == null) { throw new IllegalStateException("get() called before init()"); } } } return sInstance; } private EuiccCardController(Context context) { mContext = context; mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); ServiceManager.addService("euicc_card_controller", this); } private void checkCallingPackage(String callingPackage) { // Check the caller is LPA. mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); mCallingPackage = callingPackage; mBestComponent = EuiccConnector.findBestComponent(mContext.getPackageManager()); if (mBestComponent == null || !TextUtils.equals(mCallingPackage, mBestComponent.packageName)) { throw new SecurityException("The calling package can only be LPA."); } } @Override public void getAllProfiles(String callingPackage, IGetAllProfilesCallback getProfilesCb) { checkCallingPackage(callingPackage); // TODO(b/38206971): Get EuiccCard instance from UiccController and call the API. } @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, "Requires DUMP"); final long token = Binder.clearCallingIdentity(); super.dump(fd, pw, args); // TODO(b/38206971): dump more information. pw.println("mCallingPackage=" + mCallingPackage); pw.println("mBestComponent=" + mBestComponent); Binder.restoreCallingIdentity(token); } }