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

Commit 5ac82ad6 authored by Isaac Katzenelson's avatar Isaac Katzenelson Committed by Automerger Merge Worker
Browse files

Merge "Create returns null when resource strings are empty" into udc-dev am: 2a5d645b

parents 1aca9ccd 2a5d645b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.R;
@@ -173,10 +174,15 @@ public class SharedConnectivityManager {
                    R.string.config_sharedConnectivityServicePackage);
            String serviceIntentAction = resources.getString(
                    R.string.config_sharedConnectivityServiceIntentAction);
            if (TextUtils.isEmpty(servicePackageName) || TextUtils.isEmpty(serviceIntentAction)) {
                Log.e(TAG, "To support shared connectivity service on this device, the"
                        + " service's package name and intent action strings must not be empty");
                return null;
            }
            return new SharedConnectivityManager(context, servicePackageName, serviceIntentAction);
        } catch (Resources.NotFoundException e) {
            Log.e(TAG, "To support shared connectivity service on this device, the service's"
                    + " package name and intent action string must be defined");
                    + " package name and intent action strings must be defined");
        }
        return null;
    }
+7 −0
Original line number Diff line number Diff line
@@ -104,6 +104,13 @@ public class SharedConnectivityManagerTest {
        assertThat(SharedConnectivityManager.create(mContext)).isNull();
    }

    @Test
    public void resourceStringsAreEmpty_createShouldReturnNull() {
        when(mResources.getString(anyInt())).thenReturn("");

        assertThat(SharedConnectivityManager.create(mContext)).isNull();
    }

    @Test
    public void bindingToServiceOnFirstCallbackRegistration() {
        SharedConnectivityManager manager = SharedConnectivityManager.create(mContext);