Merge "Refactored method to get UIDs." into nyc-dev
This commit is contained in:
@@ -83,9 +83,8 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
|
|||||||
mContext = mInstrumentation.getContext();
|
mContext = mInstrumentation.getContext();
|
||||||
mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mWfm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
mWfm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
||||||
mUid = mContext.getPackageManager().getPackageInfo(TEST_APP2_PKG, 0).applicationInfo.uid;
|
mUid = getUid(TEST_APP2_PKG);
|
||||||
final int myUid = mContext.getPackageManager()
|
final int myUid = getUid(mContext.getPackageName());
|
||||||
.getPackageInfo(mContext.getPackageName(), 0).applicationInfo.uid;
|
|
||||||
|
|
||||||
Log.i(TAG, "Apps status on " + getName() + ":\n"
|
Log.i(TAG, "Apps status on " + getName() + ":\n"
|
||||||
+ "\ttest app: uid=" + myUid + ", state=" + getProcessStateByUid(myUid) + "\n"
|
+ "\ttest app: uid=" + myUid + ", state=" + getProcessStateByUid(myUid) + "\n"
|
||||||
@@ -101,6 +100,10 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getUid(String packageName) throws Exception {
|
||||||
|
return mContext.getPackageManager().getPackageUid(packageName, 0);
|
||||||
|
}
|
||||||
|
|
||||||
protected void assertRestrictBackgroundChangedReceived(int expectedCount) throws Exception {
|
protected void assertRestrictBackgroundChangedReceived(int expectedCount) throws Exception {
|
||||||
assertRestrictBackgroundChangedReceived(DYNAMIC_RECEIVER, expectedCount);
|
assertRestrictBackgroundChangedReceived(DYNAMIC_RECEIVER, expectedCount);
|
||||||
assertRestrictBackgroundChangedReceived(MANIFEST_RECEIVER, 0);
|
assertRestrictBackgroundChangedReceived(MANIFEST_RECEIVER, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user