Search in sources :

Example 31 with LogPrinter

use of android.util.LogPrinter in project android_frameworks_base by ParanoidAndroid.

the class IntentResolver method removeFilterInternal.

void removeFilterInternal(F f) {
    if (localLOGV) {
        Slog.v(TAG, "Removing filter: " + f);
        f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), "      ");
        Slog.v(TAG, "    Cleaning Lookup Maps:");
    }
    int numS = unregister_intent_filter(f, f.schemesIterator(), mSchemeToFilter, "      Scheme: ");
    int numT = unregister_mime_types(f, "      Type: ");
    if (numS == 0 && numT == 0) {
        unregister_intent_filter(f, f.actionsIterator(), mActionToFilter, "      Action: ");
    }
    if (numT != 0) {
        unregister_intent_filter(f, f.actionsIterator(), mTypedActionToFilter, "      TypedAction: ");
    }
}
Also used : LogPrinter(android.util.LogPrinter)

Example 32 with LogPrinter

use of android.util.LogPrinter in project android_frameworks_base by ParanoidAndroid.

the class IntentResolver method addFilter.

public void addFilter(F f) {
    if (localLOGV) {
        Slog.v(TAG, "Adding filter: " + f);
        f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), "      ");
        Slog.v(TAG, "    Building Lookup Maps:");
    }
    mFilters.add(f);
    int numS = register_intent_filter(f, f.schemesIterator(), mSchemeToFilter, "      Scheme: ");
    int numT = register_mime_types(f, "      Type: ");
    if (numS == 0 && numT == 0) {
        register_intent_filter(f, f.actionsIterator(), mActionToFilter, "      Action: ");
    }
    if (numT != 0) {
        register_intent_filter(f, f.actionsIterator(), mTypedActionToFilter, "      TypedAction: ");
    }
    if (VALIDATE) {
        mOldResolver.addFilter(f);
        verifyDataStructures(f);
    }
}
Also used : LogPrinter(android.util.LogPrinter)

Example 33 with LogPrinter

use of android.util.LogPrinter in project android_frameworks_base by ParanoidAndroid.

the class IntentResolverOld method addFilter.

public void addFilter(F f) {
    if (localLOGV) {
        Slog.v(TAG, "Adding filter: " + f);
        f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), "      ");
        Slog.v(TAG, "    Building Lookup Maps:");
    }
    mFilters.add(f);
    int numS = register_intent_filter(f, f.schemesIterator(), mSchemeToFilter, "      Scheme: ");
    int numT = register_mime_types(f, "      Type: ");
    if (numS == 0 && numT == 0) {
        register_intent_filter(f, f.actionsIterator(), mActionToFilter, "      Action: ");
    }
    if (numT != 0) {
        register_intent_filter(f, f.actionsIterator(), mTypedActionToFilter, "      TypedAction: ");
    }
}
Also used : LogPrinter(android.util.LogPrinter)

Example 34 with LogPrinter

use of android.util.LogPrinter in project android_frameworks_base by ParanoidAndroid.

the class IntentResolverOld method removeFilterInternal.

void removeFilterInternal(F f) {
    if (localLOGV) {
        Slog.v(TAG, "Removing filter: " + f);
        f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), "      ");
        Slog.v(TAG, "    Cleaning Lookup Maps:");
    }
    int numS = unregister_intent_filter(f, f.schemesIterator(), mSchemeToFilter, "      Scheme: ");
    int numT = unregister_mime_types(f, "      Type: ");
    if (numS == 0 && numT == 0) {
        unregister_intent_filter(f, f.actionsIterator(), mActionToFilter, "      Action: ");
    }
    if (numT != 0) {
        unregister_intent_filter(f, f.actionsIterator(), mTypedActionToFilter, "      TypedAction: ");
    }
}
Also used : LogPrinter(android.util.LogPrinter)

Example 35 with LogPrinter

use of android.util.LogPrinter in project android_frameworks_base by ParanoidAndroid.

the class Settings method readDefaultPreferredActivitiesLPw.

private void readDefaultPreferredActivitiesLPw(PackageManagerService service, XmlPullParser parser, int userId) throws XmlPullParserException, IOException {
    int outerDepth = parser.getDepth();
    int type;
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }
        String tagName = parser.getName();
        if (tagName.equals(TAG_ITEM)) {
            PreferredActivity tmpPa = new PreferredActivity(parser);
            if (tmpPa.mPref.getParseError() == null) {
                // preferred activity entry.
                if (PackageManagerService.DEBUG_PREFERRED) {
                    Log.d(TAG, "Processing preferred:");
                    tmpPa.dump(new LogPrinter(Log.DEBUG, TAG), "  ");
                }
                final ComponentName cn = tmpPa.mPref.mComponent;
                Intent intent = new Intent();
                int flags = 0;
                intent.setAction(tmpPa.getAction(0));
                for (int i = 0; i < tmpPa.countCategories(); i++) {
                    String cat = tmpPa.getCategory(i);
                    if (cat.equals(Intent.CATEGORY_DEFAULT)) {
                        flags |= PackageManager.MATCH_DEFAULT_ONLY;
                    } else {
                        intent.addCategory(cat);
                    }
                }
                if (tmpPa.countDataSchemes() > 0) {
                    Uri.Builder builder = new Uri.Builder();
                    builder.scheme(tmpPa.getDataScheme(0));
                    if (tmpPa.countDataAuthorities() > 0) {
                        IntentFilter.AuthorityEntry auth = tmpPa.getDataAuthority(0);
                        if (auth.getHost() != null) {
                            builder.authority(auth.getHost());
                        }
                    }
                    if (tmpPa.countDataPaths() > 0) {
                        PatternMatcher path = tmpPa.getDataPath(0);
                        builder.path(path.getPath());
                    }
                    intent.setData(builder.build());
                } else if (tmpPa.countDataTypes() > 0) {
                    intent.setType(tmpPa.getDataType(0));
                }
                List<ResolveInfo> ri = service.mActivities.queryIntent(intent, intent.getType(), flags, 0);
                if (PackageManagerService.DEBUG_PREFERRED)
                    Log.d(TAG, "Queried " + intent + " results: " + ri);
                int match = 0;
                if (ri != null && ri.size() > 1) {
                    boolean haveAct = false;
                    boolean haveNonSys = false;
                    ComponentName[] set = new ComponentName[ri.size()];
                    for (int i = 0; i < ri.size(); i++) {
                        ActivityInfo ai = ri.get(i).activityInfo;
                        set[i] = new ComponentName(ai.packageName, ai.name);
                        if ((ai.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                            // so don't set a default since we don't want to hide it.
                            if (PackageManagerService.DEBUG_PREFERRED)
                                Log.d(TAG, "Result " + ai.packageName + "/" + ai.name + ": non-system!");
                            haveNonSys = true;
                            break;
                        } else if (cn.getPackageName().equals(ai.packageName) && cn.getClassName().equals(ai.name)) {
                            if (PackageManagerService.DEBUG_PREFERRED)
                                Log.d(TAG, "Result " + ai.packageName + "/" + ai.name + ": default!");
                            haveAct = true;
                            match = ri.get(i).match;
                        } else {
                            if (PackageManagerService.DEBUG_PREFERRED)
                                Log.d(TAG, "Result " + ai.packageName + "/" + ai.name + ": skipped");
                        }
                    }
                    if (haveAct && !haveNonSys) {
                        PreferredActivity pa = new PreferredActivity(tmpPa, match, set, tmpPa.mPref.mComponent);
                        editPreferredActivitiesLPw(userId).addFilter(pa);
                    } else if (!haveNonSys) {
                        Slog.w(TAG, "No component found for default preferred activity " + tmpPa.mPref.mComponent);
                    }
                }
            } else {
                PackageManagerService.reportSettingsProblem(Log.WARN, "Error in package manager settings: <preferred-activity> " + tmpPa.mPref.getParseError() + " at " + parser.getPositionDescription());
            }
        } else {
            PackageManagerService.reportSettingsProblem(Log.WARN, "Unknown element under <preferred-activities>: " + parser.getName());
            XmlUtils.skipCurrentTag(parser);
        }
    }
}
Also used : IntentFilter(android.content.IntentFilter) ActivityInfo(android.content.pm.ActivityInfo) Intent(android.content.Intent) Uri(android.net.Uri) ResolveInfo(android.content.pm.ResolveInfo) ComponentName(android.content.ComponentName) PatternMatcher(android.os.PatternMatcher) LogPrinter(android.util.LogPrinter)

Aggregations

LogPrinter (android.util.LogPrinter)52 Uri (android.net.Uri)10 Editable (android.text.Editable)7 Spannable (android.text.Spannable)7 SpannableStringBuilder (android.text.SpannableStringBuilder)7 AndroidRuntimeException (android.util.AndroidRuntimeException)7 ActivityInfo (android.content.pm.ActivityInfo)6 ResolveInfo (android.content.pm.ResolveInfo)6 Intent (android.content.Intent)5 IntentFilter (android.content.IntentFilter)5 PatternMatcher (android.os.PatternMatcher)5 PrintWriterPrinter (android.util.PrintWriterPrinter)5 Printer (android.util.Printer)5 FastPrintWriter (com.android.internal.util.FastPrintWriter)5 File (java.io.File)5 PrintWriter (java.io.PrintWriter)5 EphemeralResolveInfo (android.content.pm.EphemeralResolveInfo)4 Handler (android.os.Handler)2 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1