Skip to content

Commit

Permalink
修复因com.android.webview在API 19上不存在导致ApplicationInfo测试失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
shifujun committed Aug 21, 2019
1 parent 4e6ffd8 commit 035681d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected String getTag() {

private ApplicationInfo getApplicationInfoFromHost() throws PackageManager.NameNotFoundException {
PackageManager packageManager = ApplicationProvider.getApplicationContext().getPackageManager();
return packageManager.getApplicationInfo("com.android.webview", GET_META_DATA);
return packageManager.getApplicationInfo("com.android.shell", GET_META_DATA);
}

@Override
Expand All @@ -44,7 +44,11 @@ public void testMetaData() {
@Override
public void testClassName() throws Exception {
ApplicationInfo applicationInfoFromHost = getApplicationInfoFromHost();
String className = applicationInfoFromHost.className;
if (className == null) {
className = "";
}
matchTextWithViewTag("TAG_className_" + getTag(),
applicationInfoFromHost.className);
className);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
parseApplicationInfo("PackageManagerGetSelf",
getPackageManager().getApplicationInfo(getPackageName(), GET_META_DATA));
parseApplicationInfo("PackageManagerGetOtherInstalled",
getPackageManager().getApplicationInfo("com.android.webview", GET_META_DATA));
getPackageManager().getApplicationInfo("com.android.shell", GET_META_DATA));
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 035681d

Please sign in to comment.