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

Commit d8fb3ddd authored by David Braun's avatar David Braun
Browse files

Do not attempt to configure null preferred activity

On non-phone devices the default SMS app is null. During the set/get paths
we would not try to configure the activity, but during the package update
path we called 'getDefaultSendToApplication" and configured it without
validating that it is non-null. This change adds the null check.

Bug: 11482259 When default SMS app changes we need to update the default app for the SEND intent
Change-Id: I227cfd803fd0667d78918a720b5a6eae9d57ea9d
parent 8a4c7281
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -465,9 +465,11 @@ public final class SmsApplication {
            PackageManager packageManager = mContext.getPackageManager();
            // Ensure this component is still configured as the preferred activity
            ComponentName componentName = getDefaultSendToApplication(mContext, true);
            if (componentName != null) {
                configurePreferredActivity(packageManager, componentName);
            }
        }
    }

    public static void initSmsPackageMonitor(Context context) {
        sSmsPackageMonitor = new SmsPackageMonitor(context);
@@ -480,7 +482,8 @@ public final class SmsApplication {
        replacePreferredActivity(packageManager, componentName, SCHEME_SMS);
        replacePreferredActivity(packageManager, componentName, SCHEME_SMSTO);
        replacePreferredActivity(packageManager, componentName, SCHEME_MMS);
        replacePreferredActivity(packageManager, componentName, SCHEME_MMSTO);}
        replacePreferredActivity(packageManager, componentName, SCHEME_MMSTO);
    }

    /**
     * Updates the ACTION_SENDTO activity to the specified component for the specified scheme.