Loading core/res/res/values/config.xml +0 −6 Original line number Diff line number Diff line Loading @@ -5317,10 +5317,4 @@ <string-array name="config_serviceStateLocationAllowedPackages"> <item>"com.android.phone"</item> </string-array> <!-- List of packages which requires permissions reset after update. --> <string-array name="config_network_policy_manager_replacing_packages"> <!-- <item>packageName</item> --> <item>com.android.vending</item> </string-array> </resources> core/res/res/values/symbols.xml +0 −1 Original line number Diff line number Diff line Loading @@ -4495,5 +4495,4 @@ <java-symbol type="array" name="config_builtInDisplayIsRoundArray" /> <java-symbol type="array" name="config_serviceStateLocationAllowedPackages" /> <java-symbol type="dimen" name="status_bar_height_default" /> <java-symbol type="array" name="config_network_policy_manager_replacing_packages" /> </resources> services/core/java/com/android/server/net/NetworkPolicyManagerService.java +1 −43 Original line number Diff line number Diff line Loading @@ -180,7 +180,6 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageInfo; Loading Loading @@ -1157,7 +1156,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final int uid = intent.getIntExtra(EXTRA_UID, -1); if (uid == -1) return; if (intent.getBooleanExtra(EXTRA_REPLACING, false) && !doesUidMatchPackages(uid)) { if (intent.getBooleanExtra(EXTRA_REPLACING, false)) { if (LOGV) Slog.v(TAG, "ACTION_PACKAGE_ADDED Not new app, skip it uid=" + uid); return; } Loading Loading @@ -1324,47 +1323,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } }; private boolean doesUidMatchPackages(int uid) { final String packageName = getPackageForUid(uid); if (packageName == null || !isSystemApp(uid)) return false; final Context deviceContext = mContext.createDeviceProtectedStorageContext(); final File prefsFile = new File(new File(Environment.getDataSystemDirectory(), "shared_prefs"), "network_policy_whitelist_config.xml"); SharedPreferences mSharedPreferences = deviceContext.getSharedPreferences(prefsFile, Context.MODE_PRIVATE); String[] packagePairs = mContext.getResources().getStringArray( com.android.internal.R.array.config_network_policy_manager_replacing_packages); for (String packageToMatch : packagePairs) { if (packageToMatch == null || mSharedPreferences.getBoolean(packageToMatch, false)) continue; if (packageName.equals(packageToMatch)) { if (LOGD) Log.d(TAG, "UID match found packageName: " + packageName); mSharedPreferences.edit().putBoolean(packageToMatch, true).apply(); return !hasInternetPermissionUL(uid); } } if (LOGD) Log.d(TAG, "UID matches not found for packageName: " + packageName); return false; } private boolean isSystemApp(int uid) { final String packageName = getPackageForUid(uid); if (packageName == null) return false; final ApplicationInfo appInfo; try { appInfo = mContext.getPackageManager().getApplicationInfo(packageName, PackageManager.MATCH_UNINSTALLED_PACKAGES); } catch (PackageManager.NameNotFoundException ignored) { return false; } return appInfo.isSystemApp(); } private static boolean updateCapabilityChange(SparseBooleanArray lastValues, boolean newValue, Network network) { final boolean lastValue = lastValues.get(network.getNetId(), false); Loading Loading
core/res/res/values/config.xml +0 −6 Original line number Diff line number Diff line Loading @@ -5317,10 +5317,4 @@ <string-array name="config_serviceStateLocationAllowedPackages"> <item>"com.android.phone"</item> </string-array> <!-- List of packages which requires permissions reset after update. --> <string-array name="config_network_policy_manager_replacing_packages"> <!-- <item>packageName</item> --> <item>com.android.vending</item> </string-array> </resources>
core/res/res/values/symbols.xml +0 −1 Original line number Diff line number Diff line Loading @@ -4495,5 +4495,4 @@ <java-symbol type="array" name="config_builtInDisplayIsRoundArray" /> <java-symbol type="array" name="config_serviceStateLocationAllowedPackages" /> <java-symbol type="dimen" name="status_bar_height_default" /> <java-symbol type="array" name="config_network_policy_manager_replacing_packages" /> </resources>
services/core/java/com/android/server/net/NetworkPolicyManagerService.java +1 −43 Original line number Diff line number Diff line Loading @@ -180,7 +180,6 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageInfo; Loading Loading @@ -1157,7 +1156,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final int uid = intent.getIntExtra(EXTRA_UID, -1); if (uid == -1) return; if (intent.getBooleanExtra(EXTRA_REPLACING, false) && !doesUidMatchPackages(uid)) { if (intent.getBooleanExtra(EXTRA_REPLACING, false)) { if (LOGV) Slog.v(TAG, "ACTION_PACKAGE_ADDED Not new app, skip it uid=" + uid); return; } Loading Loading @@ -1324,47 +1323,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } }; private boolean doesUidMatchPackages(int uid) { final String packageName = getPackageForUid(uid); if (packageName == null || !isSystemApp(uid)) return false; final Context deviceContext = mContext.createDeviceProtectedStorageContext(); final File prefsFile = new File(new File(Environment.getDataSystemDirectory(), "shared_prefs"), "network_policy_whitelist_config.xml"); SharedPreferences mSharedPreferences = deviceContext.getSharedPreferences(prefsFile, Context.MODE_PRIVATE); String[] packagePairs = mContext.getResources().getStringArray( com.android.internal.R.array.config_network_policy_manager_replacing_packages); for (String packageToMatch : packagePairs) { if (packageToMatch == null || mSharedPreferences.getBoolean(packageToMatch, false)) continue; if (packageName.equals(packageToMatch)) { if (LOGD) Log.d(TAG, "UID match found packageName: " + packageName); mSharedPreferences.edit().putBoolean(packageToMatch, true).apply(); return !hasInternetPermissionUL(uid); } } if (LOGD) Log.d(TAG, "UID matches not found for packageName: " + packageName); return false; } private boolean isSystemApp(int uid) { final String packageName = getPackageForUid(uid); if (packageName == null) return false; final ApplicationInfo appInfo; try { appInfo = mContext.getPackageManager().getApplicationInfo(packageName, PackageManager.MATCH_UNINSTALLED_PACKAGES); } catch (PackageManager.NameNotFoundException ignored) { return false; } return appInfo.isSystemApp(); } private static boolean updateCapabilityChange(SparseBooleanArray lastValues, boolean newValue, Network network) { final boolean lastValue = lastValues.get(network.getNetId(), false); Loading