0
private boolean isEphemeralAllowed(
        Intent intent, List<ResolveInfo> resolvedActivities, int userId,
        boolean skipPackageCheck) {

    // Short circuit and return early if possible.
    if (isEphemeralDisabled()) {
        return false;
    }
    final int callingUser = UserHandle.getCallingUserId();
    if (callingUser != UserHandle.USER_SYSTEM) {
        return false;
    }
    if (mEphemeralResolverConnection == null) {
        return false;
    }
    if (intent.getComponent() != null) {
        return false;
    }
    if ((intent.getFlags() & Intent.FLAG_IGNORE_EPHEMERAL) != 0) {
        return false;
    }
    if (!skipPackageCheck && intent.getPackage() != null) {
        return false;
    }
    final boolean isWebUri = hasWebURI(intent);



private boolean isEphemeralDisabled() {
    // ephemeral apps have been disabled across the board
    if (DISABLE_EPHEMERAL_APPS) {
        return true;
    }
    // system isn't up yet; can't read settings, so, assume no ephemeral apps
    if (!mSystemReady) {
        return true;
    }

    // we can't get a content resolver until the system is ready; these checks must happen last
    final ContentResolver resolver = mContext.getContentResolver();
    if (Global.getInt(resolver, Global.ENABLE_EPHEMERAL_FEATURE, 1) == 0) {
        return true;
    }
    return Secure.getInt(resolver, Secure.WEB_ACTION_ENABLED, 1) == 0;

}

For Android 7.0, DISABLE_EPHEMERAL_APPS default is true

private static final boolean DISABLE_EPHEMERAL_APPS = true;

But in Android 7.1, Google enabled Instant apps support: https://android.googlesource.com/platform/frameworks/base.git/+/7ef97b6624054fff0d712d85336a45eee70bcc3f%5E%21/#F0

for isEphemeralAllowed method, if call resolveIntent, most of intents will call isEphemeralAllowed method, so this will cause PackageManager service user binder call settingProvider, and will probability cause a deadlock.

Volo
  • 28,673
  • 12
  • 97
  • 125
yanqing mo
  • 11
  • 1
  • Please, don't post your thread dumps as answers. StackOverflow is Question&Answer site and not a regular forum, where one can post multiple posts in a row. Please have a look here: https://stackoverflow.com/tour. If you wish to add additional information to your question (e.g. a thread dump), just edit the question and put it there. – Volo Aug 07 '17 at 09:28
  • If you can reproduce this issue, consider filing a bug report in the public issue tracker: https://issuetracker.google.com/issues?q=componentid:316045%2B – Troy Aug 18 '17 at 19:28
  • Android 8.0, google use observer to judge isEphemeralAllowed mode; During monkey test, this case can low probability reproduce. – yanqing mo Sep 25 '17 at 11:42

0 Answers0