天津出行司机端 v6.9.3版本的 MD5 值为:b7a18e0f0e865860fd80aa9ed7cf4ae1
以下内容为反编译后的 AppStoreUtils.java 源代码,内容仅作参考
package com.didichuxing.doraemonkit.util;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import com.autonavi.amap.mapcore.AMapEngineUtils;
import java.util.List;
public final class AppStoreUtils {
private static final String GOOGLE_PLAY_APP_STORE_PACKAGE_NAME = "com.android.vending";
private static final String TAG = "AppStoreUtils";
public static Intent getAppStoreIntent() {
return getAppStoreIntent(Utils.getApp().getPackageName(), false);
}
public static Intent getAppStoreIntent(boolean isIncludeGooglePlayStore) {
return getAppStoreIntent(Utils.getApp().getPackageName(), isIncludeGooglePlayStore);
}
public static Intent getAppStoreIntent(final String packageName) {
return getAppStoreIntent(packageName, false);
}
public static Intent getAppStoreIntent(final String packageName, boolean isIncludeGooglePlayStore) {
Intent leecoAppStoreIntent;
Intent samsungAppStoreIntent;
if (!RomUtils.isSamsung() || (samsungAppStoreIntent = getSamsungAppStoreIntent(packageName)) == null) {
if (!RomUtils.isLeeco() || (leecoAppStoreIntent = getLeecoAppStoreIntent(packageName)) == null) {
Uri uri = Uri.parse("market://details?id=" + packageName);
Intent intent = new Intent();
intent.setData(uri);
intent.addFlags(AMapEngineUtils.MAX_P20_WIDTH);
List<ResolveInfo> resolveInfos = Utils.getApp().getPackageManager().queryIntentActivities(intent, 65536);
if (resolveInfos == null || resolveInfos.size() == 0) {
Log.e(TAG, "No app store!");
return null;
}
Intent googleIntent = null;
for (ResolveInfo resolveInfo : resolveInfos) {
String pkgName = resolveInfo.activityInfo.packageName;
if (!"com.android.vending".equals(pkgName)) {
if (AppUtils.isAppSystem(pkgName)) {
intent.setPackage(pkgName);
return intent;
}
} else {
intent.setPackage("com.android.vending");
googleIntent = intent;
}
}
if (isIncludeGooglePlayStore && googleIntent != null) {
return googleIntent;
}
intent.setPackage(resolveInfos.get(0).activityInfo.packageName);
return intent;
}
return leecoAppStoreIntent;
}
return samsungAppStoreIntent;
}
private static Intent getSamsungAppStoreIntent(final String packageName) {
Intent intent = new Intent();
intent.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main");
intent.setData(Uri.parse("http://www.samsungapps.com/appquery/appDetail.as?appId=" + packageName));
intent.addFlags(AMapEngineUtils.MAX_P20_WIDTH);
if (getAvailableIntentSize(intent) > 0) {
return intent;
}
return null;
}
private static Intent getLeecoAppStoreIntent(final String packageName) {
Intent intent = new Intent();
intent.setClassName("com.letv.app.appstore", "com.letv.app.appstore.appmodule.details.DetailsActivity");
intent.setAction("com.letv.app.appstore.appdetailactivity");
intent.putExtra("packageName", packageName);
intent.addFlags(AMapEngineUtils.MAX_P20_WIDTH);
if (getAvailableIntentSize(intent) > 0) {
return intent;
}
return null;
}
private static int getAvailableIntentSize(final Intent intent) {
return Utils.getApp().getPackageManager().queryIntentActivities(intent, 65536).size();
}
}