diff options
Diffstat (limited to 'java')
4 files changed, 10 insertions, 43 deletions
diff --git a/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java b/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java index 1b5391da8..c9c09b322 100644 --- a/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java +++ b/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java @@ -31,6 +31,6 @@ public class CarrierVvmPackageInstalledReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { String packageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME); VvmLog.i("CarrierVvmPackageInstalledReceiver.onReceive", "package installed: " + packageName); - VvmPackageInstallHandler.handlePackageInstalled(context, packageName); + VvmPackageInstallHandler.handlePackageInstalled(context); } } diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java index d5cde72bd..ef62d2a75 100644 --- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java +++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java @@ -178,9 +178,6 @@ public class OmtpVvmCarrierConfigHelper { if (protocol == null) { return false; } - if (isCarrierAppPreloaded()) { - return false; - } return true; } @@ -248,20 +245,7 @@ public class OmtpVvmCarrierConfigHelper { if (!isValid()) { return false; } - - Set<String> carrierPackages = getCarrierVvmPackageNames(); - if (carrierPackages == null) { - return true; - } - for (String packageName : carrierPackages) { - try { - context.getPackageManager().getPackageInfo(packageName, 0); - return false; - } catch (NameNotFoundException e) { - // Do nothing. - } - } - return true; + return !isCarrierAppInstalled(); } public boolean isCellularDataRequired() { @@ -511,7 +495,8 @@ public class OmtpVvmCarrierConfigHelper { overrideConfigForTest = config; } - private boolean isCarrierAppPreloaded() { + /** Checks if the carrier VVM app is installed. */ + public boolean isCarrierAppInstalled() { Set<String> carrierPackages = getCarrierVvmPackageNamesWithoutValidation(); if (carrierPackages == null) { return false; @@ -522,12 +507,7 @@ public class OmtpVvmCarrierConfigHelper { if (!info.enabled) { continue; } - if ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0 - || (info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { - VvmLog.i(TAG, packageName + " preloaded, force disabling dialer vvm"); - return true; - } - + return true; } catch (NameNotFoundException e) { continue; } diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java index 75d6dfc66..993594eb3 100644 --- a/java/com/android/voicemail/impl/VoicemailClientImpl.java +++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java @@ -78,7 +78,8 @@ public class VoicemailClientImpl implements VoicemailClient { @Override public boolean hasCarrierSupport(Context context, PhoneAccountHandle phoneAccountHandle) { - return new OmtpVvmCarrierConfigHelper(context, phoneAccountHandle).isValid(); + OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, phoneAccountHandle); + return config.isValid() && !config.isCarrierAppInstalled(); } @Override diff --git a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java index 07900c26f..276b7889a 100644 --- a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java +++ b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java @@ -42,7 +42,7 @@ public final class VvmPackageInstallHandler { * Iterates through all phone account and disable VVM on a account if {@code packageName} is * listed as a carrier VVM package. */ - public static void handlePackageInstalled(Context context, String packageName) { + public static void handlePackageInstalled(Context context) { // This get called every time an app is installed and will be noisy. Don't log until the app // is identified as a carrier VVM app. for (PhoneAccountHandle phoneAccount : @@ -52,25 +52,11 @@ public final class VvmPackageInstallHandler { if (!carrierConfigHelper.isValid()) { continue; } - if (carrierConfigHelper.getCarrierVvmPackageNames() == null) { - continue; - } - if (!carrierConfigHelper.getCarrierVvmPackageNames().contains(packageName)) { - continue; - } - - VvmLog.i("VvmPackageInstallHandler.handlePackageInstalled", "Carrier app installed"); - if (VisualVoicemailSettingsUtil.isEnabledUserSet(context, phoneAccount)) { - // Skip the check if this voicemail source's setting is overridden by the user. - VvmLog.i( - "VvmPackageInstallHandler.handlePackageInstalled", - "VVM enabled by user, not disabling"); + if (!carrierConfigHelper.isCarrierAppInstalled()) { continue; } - // Force deactivate the client. The user can re-enable it in the settings. - // There is no need to update the settings for deactivation. At this point, if the - // default value is used it should be false because a carrier package is present. + // Force deactivate the client. VvmLog.i( "VvmPackageInstallHandler.handlePackageInstalled", "Carrier VVM package installed, disabling system VVM client"); |