summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Chen <refuhoo@google.com>2018-08-27 20:38:29 -0700
committerMalcolm Chen <refuhoo@google.com>2018-10-09 14:50:20 -0700
commit800a7d6dbfb3ff06e99594a639bbe8f511077bfe (patch)
tree1143b9657815989def57d6af1ded26165bf5e73a
parent120b7fba9304025d3c630bf4b3681fc30108c2b4 (diff)
downloadbase-800a7d6dbfb3ff06e99594a639bbe8f511077bfe.tar.gz
Add VisibleForTesting to create TelephonyRegistryTest.
Bug: 113305153 Test: unittest Change-Id: Ie59b2da76fbc813ce011d4d0ab3ff533a6006e14 Merged-In: Ie59b2da76fbc813ce011d4d0ab3ff533a6006e14
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java7
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java7
2 files changed, 11 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 0f9fe83ba6a5..51c6aa16361a 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -50,6 +50,7 @@ import android.telephony.TelephonyManager;
import android.telephony.VoLteServiceState;
import android.util.LocalLog;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
import com.android.internal.telephony.IPhoneStateListener;
@@ -82,7 +83,8 @@ import java.util.NoSuchElementException;
* Eventually we may want to remove the notion of dummy value but for now this
* looks like the best approach.
*/
-class TelephonyRegistry extends ITelephonyRegistry.Stub {
+@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private static final String TAG = "TelephonyRegistry";
private static final boolean DBG = false; // STOPSHIP if true
private static final boolean DBG_LOC = false; // STOPSHIP if true
@@ -324,7 +326,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
// calls go through a oneway interface and local calls going through a
// handler before they get to app code.
- TelephonyRegistry(Context context) {
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+ public TelephonyRegistry(Context context) {
CellLocation location = CellLocation.getEmpty();
mContext = context;
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index bd6a59d7492c..498be968265f 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -23,6 +23,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.IPhoneStateListener;
import java.lang.ref.WeakReference;
@@ -778,8 +779,12 @@ public class PhoneStateListener {
}
}
+ /**
+ * @hide
+ */
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
@UnsupportedAppUsage
- IPhoneStateListener callback = new IPhoneStateListenerStub(this);
+ public final IPhoneStateListener callback = new IPhoneStateListenerStub(this);
private void log(String s) {
Rlog.d(LOG_TAG, s);