]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Add fallback for the old name of the profile ID extra
authorTobias Brunner <tobias@strongswan.org>
Mon, 26 Feb 2024 10:01:55 +0000 (11:01 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 26 Feb 2024 10:01:55 +0000 (11:01 +0100)
This fixes existing shortcuts and automation via Intents.

Fixes: 8e3b921abed7 ("android: Always use UUID to access profiles")
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileControlActivity.java

index d9ef939ba077c9cbe18192a04f2e993dcb9d0443..a7b39b6ac2047580834e885aee6fdacb67d36abb 100644 (file)
@@ -65,6 +65,7 @@ public class VpnProfileControlActivity extends AppCompatActivity
        public static final String START_PROFILE = "org.strongswan.android.action.START_PROFILE";
        public static final String DISCONNECT = "org.strongswan.android.action.DISCONNECT";
        public static final String EXTRA_VPN_PROFILE_UUID = "org.strongswan.android.VPN_PROFILE_UUID";
+       private static final String EXTRA_VPN_PROFILE_ID = "org.strongswan.android.VPN_PROFILE_ID";
 
        private static final String WAITING_FOR_RESULT = "WAITING_FOR_RESULT";
        private static final String PROFILE_NAME = "PROFILE_NAME";
@@ -378,6 +379,10 @@ public class VpnProfileControlActivity extends AppCompatActivity
                VpnProfileDataSource dataSource = new VpnProfileSource(this);
                dataSource.open();
                String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_UUID);
+               if (profileUUID == null)
+               {
+                       profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_ID);
+               }
                if (profileUUID != null)
                {
                        profile = dataSource.getVpnProfile(profileUUID);
@@ -407,6 +412,10 @@ public class VpnProfileControlActivity extends AppCompatActivity
                removeFragmentByTag(DIALOG_TAG);
 
                String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_UUID);
+               if (profileUUID == null)
+               {
+                       profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_ID);
+               }
                if (profileUUID != null)
                {
                        VpnProfileDataSource dataSource = new VpnProfileSource(this);