]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Always use UUID to access profiles
authorMarkus Pfeiffer <markus.pfeiffer@relution.io>
Tue, 21 Nov 2023 14:37:22 +0000 (15:37 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 21 Feb 2024 11:24:52 +0000 (12:24 +0100)
Use the UUID rather than the ID to ensure there are no conflicts between
profiles from the database and managed profiles.

13 files changed:
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfile.java
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfileDataSource.java
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfileSource.java
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfileSqlDataSource.java
src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
src/frontends/android/app/src/main/java/org/strongswan/android/logic/VpnStateService.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/MainActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileControlActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileImportActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileListFragment.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileSelectActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java

index f95082711abbfdf8461da6e7de5b2e3d039ef7c5..1d3c2bbcab0e4b55607f0b63d2db0821f0ae919c 100644 (file)
@@ -22,6 +22,7 @@ package org.strongswan.android.data;
 import android.text.TextUtils;
 
 import java.util.Arrays;
+import java.util.Objects;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.UUID;
@@ -339,16 +340,22 @@ public class VpnProfile implements Cloneable
        @Override
        public boolean equals(Object o)
        {
-               if (o != null && o instanceof VpnProfile)
+               if (o == this)
                {
-                       VpnProfile other = (VpnProfile)o;
-                       if (this.mUUID != null && other.getUUID() != null)
-                       {
-                               return this.mUUID.equals(other.getUUID());
-                       }
-                       return this.mId == other.getId();
+                       return true;
+               }
+               if (o == null || getClass() != o.getClass())
+               {
+                       return false;
                }
-               return false;
+               VpnProfile that = (VpnProfile)o;
+               return Objects.equals(mUUID, that.mUUID);
+       }
+
+       @Override
+       public int hashCode()
+       {
+               return Objects.hash(mUUID);
        }
 
        @Override
index 07308956c7c22a0d5f7d32a3fa9a46689cc202c5..f5bc692cccaeaeb04c26084c477ac0c9242cd2fd 100644 (file)
@@ -89,14 +89,6 @@ public interface VpnProfileDataSource
         */
        boolean deleteVpnProfile(VpnProfile profile);
 
-       /**
-        * Get a single VPN profile from the database.
-        *
-        * @param id the ID of the VPN profile
-        * @return the profile or null, if not found
-        */
-       VpnProfile getVpnProfile(long id);
-
        /**
         * Get a single VPN profile from the database by its UUID.
         *
index 98e87945211ee9589d28b665706e7f8c8b22885f..4a709989ac095a9371de01c34b6d51c589eaa051 100644 (file)
@@ -71,20 +71,6 @@ public class VpnProfileSource implements VpnProfileDataSource
                return vpnProfileSqlDataSource.deleteVpnProfile(profile);
        }
 
-       @Override
-       public VpnProfile getVpnProfile(long id)
-       {
-               for (final VpnProfileDataSource source : dataSources)
-               {
-                       final VpnProfile profile = source.getVpnProfile(id);
-                       if (profile != null)
-                       {
-                               return profile;
-                       }
-               }
-               return null;
-       }
-
        @Override
        public VpnProfile getVpnProfile(UUID uuid)
        {
index 7032009ca9aff26e557aa11a7b9e37e5da224ab6..0934edc3921e7e105693ab15e4639a7fa34e451f 100644 (file)
@@ -298,30 +298,16 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
        @Override
        public boolean updateVpnProfile(VpnProfile profile)
        {
-               long id = profile.getId();
+               final UUID uuid = profile.getUUID();
                ContentValues values = ContentValuesFromVpnProfile(profile);
-               return mDatabase.update(TABLE_VPNPROFILE, values, KEY_ID + " = " + id, null) > 0;
+               return mDatabase.update(TABLE_VPNPROFILE, values, KEY_UUID + " = ?", new String[]{uuid.toString()}) > 0;
        }
 
        @Override
        public boolean deleteVpnProfile(VpnProfile profile)
        {
-               long id = profile.getId();
-               return mDatabase.delete(TABLE_VPNPROFILE, KEY_ID + " = " + id, null) > 0;
-       }
-
-       @Override
-       public VpnProfile getVpnProfile(long id)
-       {
-               VpnProfile profile = null;
-               Cursor cursor = mDatabase.query(TABLE_VPNPROFILE, ALL_COLUMNS,
-                                                                               KEY_ID + "=" + id, null, null, null, null);
-               if (cursor.moveToFirst())
-               {
-                       profile = VpnProfileFromCursor(cursor);
-               }
-               cursor.close();
-               return profile;
+               final UUID uuid = profile.getUUID();
+               return mDatabase.delete(TABLE_VPNPROFILE, KEY_UUID + " = ?", new String[]{uuid.toString()}) > 0;
        }
 
        @Override
@@ -358,7 +344,6 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
        private VpnProfile VpnProfileFromCursor(Cursor cursor)
        {
                VpnProfile profile = new VpnProfile();
-               profile.setId(cursor.getLong(cursor.getColumnIndexOrThrow(KEY_ID)));
                profile.setUUID(UUID.fromString(cursor.getString(cursor.getColumnIndexOrThrow(KEY_UUID))));
                profile.setName(cursor.getString(cursor.getColumnIndexOrThrow(KEY_NAME)));
                profile.setGateway(cursor.getString(cursor.getColumnIndexOrThrow(KEY_GATEWAY)));
index 115ff7cec428e9392b160fa87b6bd9a94c78c945..03e59f7ee2ad753ed07d7f230548932a7d8baf62 100644 (file)
@@ -462,7 +462,7 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
                                Intent intent = new Intent(getApplicationContext(), VpnProfileControlActivity.class);
                                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                intent.setAction(VpnProfileControlActivity.START_PROFILE);
-                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_UUID, profile.getUUID().toString());
                                int flags = PendingIntent.FLAG_UPDATE_CURRENT;
                                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
                                {
index 53c22d45aaa6c7c5360eea0eb64aaa74c0fcdd03..ccce06e4c75c23d70301facbf4c5eb6595abc435 100644 (file)
@@ -55,11 +55,11 @@ public class VpnStateService extends Service
        private ErrorState mError = ErrorState.NO_ERROR;
        private ImcState mImcState = ImcState.UNKNOWN;
        private final LinkedList<RemediationInstruction> mRemediationInstructions = new LinkedList<RemediationInstruction>();
-       private static long RETRY_INTERVAL = 1000;
+       private static final long RETRY_INTERVAL = 1000;
        /* cap the retry interval at 2 minutes */
-       private static long MAX_RETRY_INTERVAL = 120000;
-       private static int RETRY_MSG = 1;
-       private RetryTimeoutProvider mTimeoutProvider = new RetryTimeoutProvider();
+       private static final long MAX_RETRY_INTERVAL = 120000;
+       private static final int RETRY_MSG = 1;
+       private final RetryTimeoutProvider mTimeoutProvider = new RetryTimeoutProvider();
        private long mRetryTimeout;
        private long mRetryIn;
 
@@ -89,7 +89,7 @@ public class VpnStateService extends Service
         */
        public interface VpnStateListener
        {
-               public void stateChanged();
+               void stateChanged();
        }
 
        /**
@@ -169,6 +169,7 @@ public class VpnStateService extends Service
 
        /**
         * Get the total number of seconds until there is an automatic retry to reconnect.
+        *
         * @return total number of seconds until the retry
         */
        public int getRetryTimeout()
@@ -178,6 +179,7 @@ public class VpnStateService extends Service
 
        /**
         * Get the number of seconds until there is an automatic retry to reconnect.
+        *
         * @return number of seconds until the retry
         */
        public int getRetryIn()
@@ -283,8 +285,9 @@ public class VpnStateService extends Service
 
        /**
         * Connect (or reconnect) a profile
+        *
         * @param profileInfo optional profile info (basically the UUID and password), taken from the
-        *                    previous profile if null
+        * previous profile if null
         * @param fromScratch true if this is a manual retry/reconnect or a completely new connection
         */
        public void connect(Bundle profileInfo, boolean fromScratch)
@@ -330,7 +333,7 @@ public class VpnStateService extends Service
                                Intent intent = new Intent(this, VpnProfileControlActivity.class);
                                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                intent.setAction(VpnProfileControlActivity.START_PROFILE);
-                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, mProfile.getUUID().toString());
+                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_UUID, mProfile.getUUID().toString());
                                startActivity(intent);
                                /* reset the retry timer immediately in case the user needs more time to enter the password */
                                notifyListeners(() -> {
@@ -353,7 +356,8 @@ public class VpnStateService extends Service
         */
        private void notifyListeners(final Callable<Boolean> change)
        {
-               mHandler.post(new Runnable() {
+               mHandler.post(new Runnable()
+               {
                        @Override
                        public void run()
                        {
@@ -386,7 +390,8 @@ public class VpnStateService extends Service
         */
        public void startConnection(final VpnProfile profile)
        {
-               notifyListeners(new Callable<Boolean>() {
+               notifyListeners(new Callable<Boolean>()
+               {
                        @Override
                        public Boolean call() throws Exception
                        {
@@ -411,7 +416,8 @@ public class VpnStateService extends Service
         */
        public void setState(final State state)
        {
-               notifyListeners(new Callable<Boolean>() {
+               notifyListeners(new Callable<Boolean>()
+               {
                        @Override
                        public Boolean call() throws Exception
                        {
@@ -438,7 +444,8 @@ public class VpnStateService extends Service
         */
        public void setError(final ErrorState error)
        {
-               notifyListeners(new Callable<Boolean>() {
+               notifyListeners(new Callable<Boolean>()
+               {
                        @Override
                        public Boolean call() throws Exception
                        {
@@ -471,7 +478,8 @@ public class VpnStateService extends Service
         */
        public void setImcState(final ImcState state)
        {
-               notifyListeners(new Callable<Boolean>() {
+               notifyListeners(new Callable<Boolean>()
+               {
                        @Override
                        public Boolean call() throws Exception
                        {
@@ -501,7 +509,8 @@ public class VpnStateService extends Service
         */
        public void addRemediationInstruction(final RemediationInstruction instruction)
        {
-               mHandler.post(new Runnable() {
+               mHandler.post(new Runnable()
+               {
                        @Override
                        public void run()
                        {
@@ -535,7 +544,8 @@ public class VpnStateService extends Service
        /**
         * Special Handler subclass that handles the retry countdown (more accurate than CountDownTimer)
         */
-       private static class RetryHandler extends Handler {
+       private static class RetryHandler extends Handler
+       {
                WeakReference<VpnStateService> mService;
 
                public RetryHandler(Looper looper, VpnStateService service)
@@ -604,6 +614,7 @@ public class VpnStateService extends Service
                /**
                 * Called each time a new retry timeout is started. The timeout increases until reset() is
                 * called and the base timeout is returned again.
+                *
                 * @param error Error state
                 */
                public long getTimeout(ErrorState error)
index a48a0a886b1ef97e712083f6255ef1f796fdc46c..a836ffbcc7a88489f528394a256b9634787f2826 100644 (file)
@@ -115,7 +115,7 @@ public class MainActivity extends AppCompatActivity implements OnVpnProfileSelec
        {
                Intent intent = new Intent(this, VpnProfileControlActivity.class);
                intent.setAction(VpnProfileControlActivity.START_PROFILE);
-               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_UUID, profile.getUUID().toString());
                startActivity(intent);
        }
 
index fb83c4e10c3f8304471af08980374a522f2e9f8d..d9ef939ba077c9cbe18192a04f2e993dcb9d0443 100644 (file)
@@ -64,7 +64,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_ID = "org.strongswan.android.VPN_PROFILE_ID";
+       public static final String EXTRA_VPN_PROFILE_UUID = "org.strongswan.android.VPN_PROFILE_UUID";
 
        private static final String WAITING_FOR_RESULT = "WAITING_FOR_RESULT";
        private static final String PROFILE_NAME = "PROFILE_NAME";
@@ -377,19 +377,11 @@ public class VpnProfileControlActivity extends AppCompatActivity
 
                VpnProfileDataSource dataSource = new VpnProfileSource(this);
                dataSource.open();
-               String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_ID);
+               String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_UUID);
                if (profileUUID != null)
                {
                        profile = dataSource.getVpnProfile(profileUUID);
                }
-               else
-               {
-                       long profileId = intent.getLongExtra(EXTRA_VPN_PROFILE_ID, 0);
-                       if (profileId > 0)
-                       {
-                               profile = dataSource.getVpnProfile(profileId);
-                       }
-               }
                dataSource.close();
 
                if (profile != null)
@@ -414,7 +406,7 @@ public class VpnProfileControlActivity extends AppCompatActivity
 
                removeFragmentByTag(DIALOG_TAG);
 
-               String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_ID);
+               String profileUUID = intent.getStringExtra(EXTRA_VPN_PROFILE_UUID);
                if (profileUUID != null)
                {
                        VpnProfileDataSource dataSource = new VpnProfileSource(this);
index 8fd12338f7f41c0364c678f31a050dda103a89b8..30787e1fd0c243c0ba24586584db8cff76bb95f8 100644 (file)
@@ -88,7 +88,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 public class VpnProfileDetailActivity extends AppCompatActivity
 {
        private VpnProfileDataSource mDataSource;
-       private Long mId;
+       private String mUuid;
        private TrustedCertificateEntry mCertEntry;
        private String mUserCertLoading;
        private CertificateIdentitiesAdapter mSelectUserIdAdapter;
@@ -380,11 +380,11 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                        }
                });
 
-               mId = savedInstanceState == null ? null : savedInstanceState.getLong(VpnProfileDataSource.KEY_ID);
-               if (mId == null)
+               mUuid = savedInstanceState == null ? null : savedInstanceState.getString(VpnProfileDataSource.KEY_UUID);
+               if (mUuid == null)
                {
                        Bundle extras = getIntent().getExtras();
-                       mId = extras == null ? null : extras.getLong(VpnProfileDataSource.KEY_ID);
+                       mUuid = extras == null ? null : extras.getString(VpnProfileDataSource.KEY_UUID);
                }
 
                loadProfileData(savedInstanceState);
@@ -406,9 +406,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
        protected void onSaveInstanceState(Bundle outState)
        {
                super.onSaveInstanceState(outState);
-               if (mId != null)
+               if (mUuid != null)
                {
-                       outState.putLong(VpnProfileDataSource.KEY_ID, mId);
+                       outState.putString(VpnProfileDataSource.KEY_UUID, mUuid);
                }
                if (mUserCertEntry != null)
                {
@@ -615,10 +615,10 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                                mDataSource.insertProfile(mProfile);
                        }
                        Intent intent = new Intent(Constants.VPN_PROFILES_CHANGED);
-                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, mProfile.getId());
+                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, mProfile.getUUID().toString());
                        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
 
-                       setResult(RESULT_OK, new Intent().putExtra(VpnProfileDataSource.KEY_ID, mProfile.getId()));
+                       setResult(RESULT_OK, new Intent().putExtra(VpnProfileDataSource.KEY_UUID, mProfile.getUUID().toString()));
                        finish();
                }
        }
@@ -757,9 +757,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                Integer flags = null;
 
                getSupportActionBar().setTitle(R.string.add_profile);
-               if (mId != null && mId != 0)
+               if (mUuid != null)
                {
-                       mProfile = mDataSource.getVpnProfile(mId);
+                       mProfile = mDataSource.getVpnProfile(mUuid);
                        if (mProfile != null)
                        {
                                mName.setText(mProfile.getName());
@@ -791,7 +791,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                        else
                        {
                                Log.e(VpnProfileDetailActivity.class.getSimpleName(),
-                                         "VPN profile with id " + mId + " not found");
+                                         "VPN profile with UUID " + mUuid + " not found");
                                finish();
                        }
                }
index 3f7c51c19c4b911cd357bc5902a53de437aeabfa..c62383ec0db3ffc300fde23eed8e991e776022d9 100644 (file)
@@ -675,7 +675,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
                        updateProfileData();
                        if (mExisting != null)
                        {
-                               mProfile.setId(mExisting.getId());
+                               mProfile.setUUID(mExisting.getUUID());
                                mDataSource.updateVpnProfile(mProfile);
                        }
                        else
@@ -697,14 +697,14 @@ public class VpnProfileImportActivity extends AppCompatActivity
                                }
                        }
                        Intent intent = new Intent(Constants.VPN_PROFILES_CHANGED);
-                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, mProfile.getId());
+                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, mProfile.getUUID().toString());
                        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
 
                        intent = new Intent(this, MainActivity.class);
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity(intent);
 
-                       setResult(RESULT_OK, new Intent().putExtra(VpnProfileDataSource.KEY_ID, mProfile.getId()));
+                       setResult(RESULT_OK, new Intent().putExtra(VpnProfileDataSource.KEY_UUID, mProfile.getUUID().toString()));
                        finish();
                }
        }
index a4ed1930838c7b7ae6b734f33292562422421d49..7c3572325d04fc696ae1b1a3955ebf48b431ca08 100644 (file)
@@ -49,6 +49,7 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.UUID;
 
 import androidx.fragment.app.Fragment;
@@ -71,12 +72,12 @@ public class VpnProfileListFragment extends Fragment
                @Override
                public void onReceive(Context context, Intent intent)
                {
-                       long id;
-                       long[] ids;
+                       String uuid;
+                       String[] uuids;
 
-                       if ((id = intent.getLongExtra(Constants.VPN_PROFILES_SINGLE, 0)) > 0)
+                       if ((uuid = intent.getStringExtra(Constants.VPN_PROFILES_SINGLE)) != null)
                        {
-                               VpnProfile profile = mDataSource.getVpnProfile(id);
+                               VpnProfile profile = mDataSource.getVpnProfile(uuid);
                                if (profile != null)
                                {       /* in case this was an edit, we remove it first */
                                        mVpnProfiles.remove(profile);
@@ -84,15 +85,15 @@ public class VpnProfileListFragment extends Fragment
                                        mListAdapter.notifyDataSetChanged();
                                }
                        }
-                       else if ((ids = intent.getLongArrayExtra(Constants.VPN_PROFILES_MULTIPLE)) != null)
+                       else if ((uuids = intent.getStringArrayExtra(Constants.VPN_PROFILES_MULTIPLE)) != null)
                        {
-                               for (long i : ids)
+                               for (String id : uuids)
                                {
                                        Iterator<VpnProfile> profiles = mVpnProfiles.iterator();
                                        while (profiles.hasNext())
                                        {
                                                VpnProfile profile = profiles.next();
-                                               if (profile.getId() == i)
+                                               if (Objects.equals(profile.getUUID().toString(), id))
                                                {
                                                        profiles.remove();
                                                        break;
@@ -272,7 +273,7 @@ public class VpnProfileListFragment extends Fragment
                                        int position = mSelected.iterator().next();
                                        VpnProfile profile = (VpnProfile)mListView.getItemAtPosition(position);
                                        Intent connectionIntent = new Intent(getActivity(), VpnProfileDetailActivity.class);
-                                       connectionIntent.putExtra(VpnProfileDataSource.KEY_ID, profile.getId());
+                                       connectionIntent.putExtra(VpnProfileDataSource.KEY_UUID, profile.getUUID().toString());
                                        startActivity(connectionIntent);
                                        break;
                                }
@@ -286,11 +287,11 @@ public class VpnProfileListFragment extends Fragment
                                        mDataSource.insertProfile(profile);
 
                                        Intent intent = new Intent(Constants.VPN_PROFILES_CHANGED);
-                                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, profile.getId());
+                                       intent.putExtra(Constants.VPN_PROFILES_SINGLE, profile.getUUID().toString());
                                        LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);
 
                                        Intent connectionIntent = new Intent(getActivity(), VpnProfileDetailActivity.class);
-                                       connectionIntent.putExtra(VpnProfileDataSource.KEY_ID, profile.getId());
+                                       connectionIntent.putExtra(VpnProfileDataSource.KEY_UUID, profile.getUUID().toString());
                                        startActivity(connectionIntent);
                                        break;
                                }
@@ -301,15 +302,15 @@ public class VpnProfileListFragment extends Fragment
                                        {
                                                profiles.add((VpnProfile)mListView.getItemAtPosition(position));
                                        }
-                                       long[] ids = new long[profiles.size()];
+                                       String[] uuids = new String[profiles.size()];
                                        for (int i = 0; i < profiles.size(); i++)
                                        {
                                                VpnProfile profile = profiles.get(i);
-                                               ids[i] = profile.getId();
+                                               uuids[i] = profile.getUUID().toString();
                                                mDataSource.deleteVpnProfile(profile);
                                        }
                                        Intent intent = new Intent(Constants.VPN_PROFILES_CHANGED);
-                                       intent.putExtra(Constants.VPN_PROFILES_MULTIPLE, ids);
+                                       intent.putExtra(Constants.VPN_PROFILES_MULTIPLE, uuids);
                                        LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);
                                        Toast.makeText(VpnProfileListFragment.this.getActivity(),
                                                                   R.string.profiles_deleted, Toast.LENGTH_SHORT).show();
index 78d8a92db2c601868acb955e6713ee3d6cb82ee6..dd64d0c7592cabed412fd535519425e6a2881862 100644 (file)
@@ -45,7 +45,7 @@ public class VpnProfileSelectActivity extends AppCompatActivity implements OnVpn
        public void onVpnProfileSelected(VpnProfile profile)
        {
                Intent shortcut = new Intent(VpnProfileControlActivity.START_PROFILE);
-               shortcut.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+               shortcut.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_UUID, profile.getUUID().toString());
 
                ShortcutInfoCompat.Builder builder = new ShortcutInfoCompat.Builder(this, profile.getUUID().toString());
                builder.setIntent(shortcut);
index 6178c59ba671f0de400aee645a7ae1bfe92b2dba..c49f4ba75e5e04814494b31dc90f35ea961a3a59 100644 (file)
@@ -140,7 +140,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
                        }
                        else if (mDataSource != null)
                        {   /* always get the plain profile without cached password */
-                               profile = mDataSource.getVpnProfile(profile.getId());
+                               profile = mDataSource.getVpnProfile(profile.getUUID());
                        }
                        /* reconnect the profile in case of an error */
                        if (mService.getErrorState() == VpnStateService.ErrorState.NO_ERROR)
@@ -173,7 +173,7 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt
                                Intent intent = new Intent(this, VpnProfileControlActivity.class);
                                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                intent.setAction(VpnProfileControlActivity.START_PROFILE);
-                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_UUID, profile.getUUID().toString());
                                if (profile.getVpnType().has(VpnType.VpnTypeFeature.USER_PASS) &&
                                        profile.getPassword() == null)
                                {       /* the user will have to enter the password, so collapse the drawer */