Loading tests/robotests/src/android/net/NetworkScorerAppData.java +21 −3 Original line number Diff line number Diff line Loading @@ -23,13 +23,20 @@ public final class NetworkScorerAppData implements Parcelable { * wifi networks automatically" feature. */ private final ComponentName mEnableUseOpenWifiActivity; /** * The {@link android.app.NotificationChannel} ID used by {@link #mRecommendationService} to * post open network notifications. */ private final String mNetworkAvailableNotificationChannelId; public NetworkScorerAppData(int packageUid, ComponentName recommendationServiceComp, String recommendationServiceLabel, ComponentName enableUseOpenWifiActivity) { String recommendationServiceLabel, ComponentName enableUseOpenWifiActivity, String networkAvailableNotificationChannelId) { this.packageUid = packageUid; this.mRecommendationService = recommendationServiceComp; this.mRecommendationServiceLabel = recommendationServiceLabel; this.mEnableUseOpenWifiActivity = enableUseOpenWifiActivity; this.mNetworkAvailableNotificationChannelId = networkAvailableNotificationChannelId; } protected NetworkScorerAppData(Parcel in) { Loading @@ -37,6 +44,7 @@ public final class NetworkScorerAppData implements Parcelable { mRecommendationService = ComponentName.readFromParcel(in); mRecommendationServiceLabel = in.readString(); mEnableUseOpenWifiActivity = ComponentName.readFromParcel(in); mNetworkAvailableNotificationChannelId = in.readString(); } @Override Loading @@ -45,6 +53,7 @@ public final class NetworkScorerAppData implements Parcelable { ComponentName.writeToParcel(mRecommendationService, dest); dest.writeString(mRecommendationServiceLabel); ComponentName.writeToParcel(mEnableUseOpenWifiActivity, dest); dest.writeString(mNetworkAvailableNotificationChannelId); } @Override Loading Loading @@ -83,6 +92,11 @@ public final class NetworkScorerAppData implements Parcelable { return mRecommendationServiceLabel; } @Nullable public String getNetworkAvailableNotificationChannelId() { return mNetworkAvailableNotificationChannelId; } @Override public String toString() { return "NetworkScorerAppData{" + Loading @@ -90,6 +104,8 @@ public final class NetworkScorerAppData implements Parcelable { ", mRecommendationService=" + mRecommendationService + ", mRecommendationServiceLabel=" + mRecommendationServiceLabel + ", mEnableUseOpenWifiActivity=" + mEnableUseOpenWifiActivity + ", mNetworkAvailableNotificationChannelId=" + mNetworkAvailableNotificationChannelId + '}'; } Loading @@ -101,12 +117,14 @@ public final class NetworkScorerAppData implements Parcelable { return packageUid == that.packageUid && Objects.equals(mRecommendationService, that.mRecommendationService) && Objects.equals(mRecommendationServiceLabel, that.mRecommendationServiceLabel) && Objects.equals(mEnableUseOpenWifiActivity, that.mEnableUseOpenWifiActivity); Objects.equals(mEnableUseOpenWifiActivity, that.mEnableUseOpenWifiActivity) && Objects.equals(mNetworkAvailableNotificationChannelId, that.mNetworkAvailableNotificationChannelId); } @Override public int hashCode() { return Objects.hash(packageUid, mRecommendationService, mRecommendationServiceLabel, mEnableUseOpenWifiActivity); mEnableUseOpenWifiActivity, mNetworkAvailableNotificationChannelId); } } tests/robotests/src/com/android/settings/network/NetworkScorerPickerPreferenceControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ public class NetworkScorerPickerPreferenceControllerTest { Settings.System.putInt(mContext.getContentResolver(), NETWORK_RECOMMENDATIONS_ENABLED, 1); ComponentName scorer = new ComponentName(TEST_SCORER_PACKAGE, TEST_SCORER_CLASS); NetworkScorerAppData scorerAppData = new NetworkScorerAppData( 0, scorer, TEST_SCORER_LABEL, null /* enableUseOpenWifiActivity */); 0, scorer, TEST_SCORER_LABEL, null /* enableUseOpenWifiActivity */, null /* networkAvailableNotificationChannelId */); when(mNetworkScorer.getActiveScorer()).thenReturn(scorerAppData); Preference preference = mock(Preference.class); Loading tests/robotests/src/com/android/settings/network/NetworkScorerPickerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ public class NetworkScorerPickerTest { public void testUpdateCandidates_validScorer() { ComponentName scorer = new ComponentName(TEST_SCORER_PACKAGE_1, TEST_SCORER_CLASS_1); NetworkScorerAppData scorerAppData = new NetworkScorerAppData( 0, scorer, TEST_SCORER_LABEL_1, null /* enableUseOpenWifiActivity */); 0, scorer, TEST_SCORER_LABEL_1, null /* enableUseOpenWifiActivity */, null /* networkAvailableNotificationChannelId */); when(mNetworkScoreManager.getAllValidScorers()).thenReturn( Lists.newArrayList(scorerAppData)); when(mNetworkScoreManager.getActiveScorerPackage()).thenReturn(TEST_SCORER_PACKAGE_1); Loading tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -56,9 +56,9 @@ import org.robolectric.annotation.Config; public class UseOpenWifiPreferenceControllerTest { private static ComponentName ENABLE_ACTIVITY_COMPONENT = new ComponentName("package", "activityClass"); private static NetworkScorerAppData APP_DATA = new NetworkScorerAppData(0, null, null, ENABLE_ACTIVITY_COMPONENT); new NetworkScorerAppData(0, null, null, ENABLE_ACTIVITY_COMPONENT, null); private static NetworkScorerAppData APP_DATA_NO_ACTIVITY = new NetworkScorerAppData(0, null, null, null); new NetworkScorerAppData(0, null, null, null, null); @Mock private Lifecycle mLifecycle; @Mock private Fragment mFragment; Loading Loading
tests/robotests/src/android/net/NetworkScorerAppData.java +21 −3 Original line number Diff line number Diff line Loading @@ -23,13 +23,20 @@ public final class NetworkScorerAppData implements Parcelable { * wifi networks automatically" feature. */ private final ComponentName mEnableUseOpenWifiActivity; /** * The {@link android.app.NotificationChannel} ID used by {@link #mRecommendationService} to * post open network notifications. */ private final String mNetworkAvailableNotificationChannelId; public NetworkScorerAppData(int packageUid, ComponentName recommendationServiceComp, String recommendationServiceLabel, ComponentName enableUseOpenWifiActivity) { String recommendationServiceLabel, ComponentName enableUseOpenWifiActivity, String networkAvailableNotificationChannelId) { this.packageUid = packageUid; this.mRecommendationService = recommendationServiceComp; this.mRecommendationServiceLabel = recommendationServiceLabel; this.mEnableUseOpenWifiActivity = enableUseOpenWifiActivity; this.mNetworkAvailableNotificationChannelId = networkAvailableNotificationChannelId; } protected NetworkScorerAppData(Parcel in) { Loading @@ -37,6 +44,7 @@ public final class NetworkScorerAppData implements Parcelable { mRecommendationService = ComponentName.readFromParcel(in); mRecommendationServiceLabel = in.readString(); mEnableUseOpenWifiActivity = ComponentName.readFromParcel(in); mNetworkAvailableNotificationChannelId = in.readString(); } @Override Loading @@ -45,6 +53,7 @@ public final class NetworkScorerAppData implements Parcelable { ComponentName.writeToParcel(mRecommendationService, dest); dest.writeString(mRecommendationServiceLabel); ComponentName.writeToParcel(mEnableUseOpenWifiActivity, dest); dest.writeString(mNetworkAvailableNotificationChannelId); } @Override Loading Loading @@ -83,6 +92,11 @@ public final class NetworkScorerAppData implements Parcelable { return mRecommendationServiceLabel; } @Nullable public String getNetworkAvailableNotificationChannelId() { return mNetworkAvailableNotificationChannelId; } @Override public String toString() { return "NetworkScorerAppData{" + Loading @@ -90,6 +104,8 @@ public final class NetworkScorerAppData implements Parcelable { ", mRecommendationService=" + mRecommendationService + ", mRecommendationServiceLabel=" + mRecommendationServiceLabel + ", mEnableUseOpenWifiActivity=" + mEnableUseOpenWifiActivity + ", mNetworkAvailableNotificationChannelId=" + mNetworkAvailableNotificationChannelId + '}'; } Loading @@ -101,12 +117,14 @@ public final class NetworkScorerAppData implements Parcelable { return packageUid == that.packageUid && Objects.equals(mRecommendationService, that.mRecommendationService) && Objects.equals(mRecommendationServiceLabel, that.mRecommendationServiceLabel) && Objects.equals(mEnableUseOpenWifiActivity, that.mEnableUseOpenWifiActivity); Objects.equals(mEnableUseOpenWifiActivity, that.mEnableUseOpenWifiActivity) && Objects.equals(mNetworkAvailableNotificationChannelId, that.mNetworkAvailableNotificationChannelId); } @Override public int hashCode() { return Objects.hash(packageUid, mRecommendationService, mRecommendationServiceLabel, mEnableUseOpenWifiActivity); mEnableUseOpenWifiActivity, mNetworkAvailableNotificationChannelId); } }
tests/robotests/src/com/android/settings/network/NetworkScorerPickerPreferenceControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ public class NetworkScorerPickerPreferenceControllerTest { Settings.System.putInt(mContext.getContentResolver(), NETWORK_RECOMMENDATIONS_ENABLED, 1); ComponentName scorer = new ComponentName(TEST_SCORER_PACKAGE, TEST_SCORER_CLASS); NetworkScorerAppData scorerAppData = new NetworkScorerAppData( 0, scorer, TEST_SCORER_LABEL, null /* enableUseOpenWifiActivity */); 0, scorer, TEST_SCORER_LABEL, null /* enableUseOpenWifiActivity */, null /* networkAvailableNotificationChannelId */); when(mNetworkScorer.getActiveScorer()).thenReturn(scorerAppData); Preference preference = mock(Preference.class); Loading
tests/robotests/src/com/android/settings/network/NetworkScorerPickerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ public class NetworkScorerPickerTest { public void testUpdateCandidates_validScorer() { ComponentName scorer = new ComponentName(TEST_SCORER_PACKAGE_1, TEST_SCORER_CLASS_1); NetworkScorerAppData scorerAppData = new NetworkScorerAppData( 0, scorer, TEST_SCORER_LABEL_1, null /* enableUseOpenWifiActivity */); 0, scorer, TEST_SCORER_LABEL_1, null /* enableUseOpenWifiActivity */, null /* networkAvailableNotificationChannelId */); when(mNetworkScoreManager.getAllValidScorers()).thenReturn( Lists.newArrayList(scorerAppData)); when(mNetworkScoreManager.getActiveScorerPackage()).thenReturn(TEST_SCORER_PACKAGE_1); Loading
tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -56,9 +56,9 @@ import org.robolectric.annotation.Config; public class UseOpenWifiPreferenceControllerTest { private static ComponentName ENABLE_ACTIVITY_COMPONENT = new ComponentName("package", "activityClass"); private static NetworkScorerAppData APP_DATA = new NetworkScorerAppData(0, null, null, ENABLE_ACTIVITY_COMPONENT); new NetworkScorerAppData(0, null, null, ENABLE_ACTIVITY_COMPONENT, null); private static NetworkScorerAppData APP_DATA_NO_ACTIVITY = new NetworkScorerAppData(0, null, null, null); new NetworkScorerAppData(0, null, null, null, null); @Mock private Lifecycle mLifecycle; @Mock private Fragment mFragment; Loading