This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
84 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
package com.android.internal.util; | ||
|
||
import android.app.compat.gms.GmsCompat; | ||
import android.os.UserHandle; | ||
|
||
import com.android.internal.gmscompat.GmsInfo; | ||
|
||
public class GoogleEuicc { | ||
// handles firmware updates of embedded secure element that is used for eSIM, NFC, Felica etc | ||
public static final String EUICC_SUPPORT_PIXEL_PKG_NAME = "com.google.euiccpixel"; | ||
public static final String LPA_PKG_NAME = "com.google.android.euicc"; | ||
|
||
public static String[] getLpaDependencies() { | ||
return new String[] { | ||
GmsInfo.PACKAGE_GSF, GmsInfo.PACKAGE_GMS_CORE, GmsInfo.PACKAGE_PLAY_STORE, | ||
}; | ||
} | ||
|
||
public static boolean checkLpaDependencies() { | ||
for (String pkg : getLpaDependencies()) { | ||
try { | ||
if (!GmsCompat.isGmsApp(pkg, UserHandle.USER_SYSTEM)) { | ||
return false; | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
services/core/java/com/android/server/ext/GoogleEuiccLpaDisabler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.android.server.ext; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.IntentFilter; | ||
import android.content.pm.PackageManager; | ||
import android.os.PatternMatcher; | ||
import android.util.Slog; | ||
|
||
import com.android.internal.util.GoogleEuicc; | ||
|
||
/** | ||
* Automatically disables Google's eUICC (eSIM) LPA package when its dependencies get uninstalled or | ||
* disabled. | ||
*/ | ||
public class GoogleEuiccLpaDisabler extends BroadcastReceiver { | ||
private static final String TAG = GoogleEuiccLpaDisabler.class.getSimpleName(); | ||
|
||
GoogleEuiccLpaDisabler(SystemServerExt sse) { | ||
var f = new IntentFilter(); | ||
f.addAction(Intent.ACTION_PACKAGE_CHANGED); | ||
f.addAction(Intent.ACTION_PACKAGE_REMOVED); | ||
f.addAction(Intent.ACTION_PACKAGE_FULLY_REMOVED); | ||
|
||
f.addDataScheme("package"); | ||
for (String pkg : GoogleEuicc.getLpaDependencies()) { | ||
f.addDataSchemeSpecificPart(pkg, PatternMatcher.PATTERN_LITERAL); | ||
} | ||
|
||
sse.registerReceiver(this, f, sse.bgHandler); | ||
} | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
// LPA is only enabled in the Owner user, which matches the userId of this Context | ||
PackageManager pm = context.getPackageManager(); | ||
try { | ||
if (!GoogleEuicc.checkLpaDependencies()) { | ||
pm.setApplicationEnabledSetting(GoogleEuicc.LPA_PKG_NAME, | ||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); | ||
} | ||
} catch (Exception e) { | ||
// don't crash the system_server | ||
Slog.e(TAG, "", e); | ||
} | ||
} | ||
} |
116 changes: 0 additions & 116 deletions
116
services/core/java/com/android/server/ext/GoogleEuiccPkgsDisabler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters