android: Add fallback for the old name of the profile ID extra

This fixes existing shortcuts and automation via Intents.

Fixes: 8e3b921abed7 ("android: Always use UUID to access profiles")
This commit is contained in:
Tobias Brunner 2024-02-26 11:01:55 +01:00
parent 1f5aa8017f
commit 45371da846

View 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);