android.util.LogPrinter Java Examples

The following examples show how to use android.util.LogPrinter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 6 votes vote down vote up
public final void removeActivity(PackageParser.Activity a, String type) {
	mActivities.remove(a.getComponentName());
	if (DEBUG_SHOW_INFO) {
		Log.v(TAG, "  " + type + " "
				+ (a.info.nonLocalizedLabel != null ? a.info.nonLocalizedLabel : a.info.name) + ":");
		Log.v(TAG, "    Class=" + a.info.name);
	}
	final int NI = a.intents.size();
	for (int j = 0; j < NI; j++) {
		PackageParser.ActivityIntentInfo intent = a.intents.get(j);
		if (DEBUG_SHOW_INFO) {
			Log.v(TAG, "    IntentFilter:");
			intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
		}
		removeFilter(intent);
	}
}
 
Example #2
Source File: IntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #3
Source File: IntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #4
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void removeProvider(DynamicApkParser.Provider p) {
    mProviders.remove(p.getComponentName().getClassName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + (p.info.nonLocalizedLabel != null
                ? p.info.nonLocalizedLabel : p.info.name) + ":");
        Log.v(TAG, "    Class=" + p.info.name);
    }
    final int NI = p.intents.size();
    int j;
    for (j = 0; j < NI; j++) {
        DynamicApkParser.ProviderIntentInfo intent = p.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
    }
}
 
Example #5
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void addProvider(DynamicApkParser.Provider p) {

            mProviders.put(p.getComponentName().getClassName(), p);
            if (DEBUG_SHOW_INFO) {
                Log.v(TAG, "  "
                        + (p.info.nonLocalizedLabel != null
                        ? p.info.nonLocalizedLabel : p.info.name) + ":");
                Log.v(TAG, "    Class=" + p.info.name);
            }
            final int NI = p.intents.size();
            int j;
            for (j = 0; j < NI; j++) {
                DynamicApkParser.ProviderIntentInfo intent = p.intents.get(j);
                if (DEBUG_SHOW_INFO) {
                    Log.v(TAG, "    IntentFilter:");
                    intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
                }
            }
        }
 
Example #6
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void removeService(DynamicApkParser.Service s, String type) {
    mServices.remove(s.getComponentName().getClassName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + type + " "
                + (s.info.nonLocalizedLabel != null ? s.info.nonLocalizedLabel
                : s.info.name) + ":");
        Log.v(TAG, "    Class=" + s.info.name);
    }
    final int NI = s.intents.size();
    for (int j=0; j<NI; j++) {
        DynamicApkParser.ServiceIntentInfo intent = s.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
    }
}
 
Example #7
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void addService(DynamicApkParser.Service s) {
    mServices.put(s.getComponentName().getClassName(), s);
    if (DEBUG_SHOW_INFO)
        Log.v(
                TAG, "  " +
                        (s.info.nonLocalizedLabel != null ? s.info.nonLocalizedLabel : s.info.name) + ":");
    if (DEBUG_SHOW_INFO)
        Log.v(TAG, "    Class=" + s.info.name);
    final int NI = s.intents.size();
    for (int j=0; j<NI; j++) {
        DynamicApkParser.ServiceIntentInfo intent = s.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
    }
}
 
Example #8
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void removeActivity(DynamicApkParser.Activity a, String type) {
    mActivities.remove(a.getComponentName().getClassName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + type + " "
                + (a.info.nonLocalizedLabel != null ? a.info.nonLocalizedLabel
                : a.info.name) + ":");
        Log.v(TAG, "    Class=" + a.info.name);
    }
    final int NI = a.intents.size();
    for (int j=0; j<NI; j++) {
        DynamicApkParser.ActivityIntentInfo intent = a.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
    }
}
 
Example #9
Source File: DynamicApkManager.java    From Android-plugin-support with MIT License 6 votes vote down vote up
public final void addActivity(DynamicApkParser.Activity a, String type) {
    mActivities.put(a.getComponentName().getClassName(), a);
    if (DEBUG_SHOW_INFO)
        Log.v(
                TAG, "  " + type + " " +
                        (a.info.nonLocalizedLabel != null ? a.info.nonLocalizedLabel : a.info.name) + ":");
    if (DEBUG_SHOW_INFO)
        Log.v(TAG, "    Class=" + a.info.name);
    final int NI = a.intents.size();
    for (int j=0; j<NI; j++) {
        DynamicApkParser.ActivityIntentInfo intent = a.intents.get(j);
        if (intent.getPriority() > 0 && "activity".equals(type)) {
            intent.setPriority(0);
            Log.w(TAG, "Package " + a.info.applicationInfo.packageName + " has activity "
                    + a.className + " with priority > 0, forcing to 0");
        }
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
    }
}
 
Example #10
Source File: IntentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #11
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 6 votes vote down vote up
public final void addActivity(PackageParser.Activity a, String type) {
	final boolean systemApp = isSystemApp(a.info.applicationInfo);
	mActivities.put(a.getComponentName(), a);
	if (DEBUG_SHOW_INFO)
		Log.v(TAG, "  " + type + " "
				+ (a.info.nonLocalizedLabel != null ? a.info.nonLocalizedLabel : a.info.name) + ":");
	if (DEBUG_SHOW_INFO)
		Log.v(TAG, "    Class=" + a.info.name);
	final int NI = a.intents.size();
	for (int j = 0; j < NI; j++) {
		PackageParser.ActivityIntentInfo intent = a.intents.get(j);
		if (!systemApp && intent.getPriority() > 0 && "activity".equals(type)) {
			intent.setPriority(0);
			Log.w(TAG, "Package " + a.info.applicationInfo.packageName + " has activity " + a.className
					+ " with priority > 0, forcing to 0");
		}
		if (DEBUG_SHOW_INFO) {
			Log.v(TAG, "    IntentFilter:");
			intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
		}
		addFilter(intent);
	}
}
 
Example #12
Source File: IntentResolver.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #13
Source File: IntentResolver.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #14
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void removeService(PackageParser.Service s) {
    mServices.remove(s.getComponentName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + (s.info.nonLocalizedLabel != null
                ? s.info.nonLocalizedLabel : s.info.name) + ":");
        Log.v(TAG, "    Class=" + s.info.name);
    }
    final int intentsSize = s.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ServiceIntentInfo intent = s.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        removeFilter(intent);
    }
}
 
Example #15
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void addService(PackageParser.Service s) {
    mServices.put(s.getComponentName(), s);
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  "
                + (s.info.nonLocalizedLabel != null
                ? s.info.nonLocalizedLabel : s.info.name) + ":");
        Log.v(TAG, "    Class=" + s.info.name);
    }
    final int intentsSize = s.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ServiceIntentInfo intent = s.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        if (!intent.debugCheck()) {
            Log.w(TAG, "==> For Service " + s.info.name);
        }
        addFilter(intent);
    }
}
 
Example #16
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void removeProvider(PackageParser.Provider p) {
    mProviders.remove(p.getComponentName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + (p.info.nonLocalizedLabel != null
                ? p.info.nonLocalizedLabel
                : p.info.name) + ":");
        Log.v(TAG, "    Class=" + p.info.name);
    }
    final int intentsSize = p.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ProviderIntentInfo intent = p.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        removeFilter(intent);
    }
}
 
Example #17
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private void removeActivity(PackageParser.Activity a, String type) {
    mActivities.remove(a.getComponentName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + type + " "
                + (a.info.nonLocalizedLabel != null ? a.info.nonLocalizedLabel
                        : a.info.name) + ":");
        Log.v(TAG, "    Class=" + a.info.name);
    }
    final int intentsSize = a.intents.size();
    for (int j = 0; j < intentsSize; j++) {
        PackageParser.ActivityIntentInfo intent = a.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        removeFilter(intent);
    }
}
 
Example #18
Source File: IntentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
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: ");
    }
}
 
Example #19
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
void addProvider(PackageParser.Provider p) {
    if (mProviders.containsKey(p.getComponentName())) {
        Slog.w(TAG, "Provider " + p.getComponentName() + " already defined; ignoring");
        return;
    }

    mProviders.put(p.getComponentName(), p);
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  "
                + (p.info.nonLocalizedLabel != null
                        ? p.info.nonLocalizedLabel
                        : p.info.name)
                + ":");
        Log.v(TAG, "    Class=" + p.info.name);
    }
    final int intentsSize = p.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ProviderIntentInfo intent = p.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        if (!intent.debugCheck()) {
            Log.w(TAG, "==> For Provider " + p.info.name);
        }
        addFilter(intent);
    }
}
 
Example #20
Source File: DownloaderService.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Utils.debugLog(TAG, "Creating downloader service.");

    HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    serviceLooper = thread.getLooper();
    if (BuildConfig.DEBUG) {
        serviceLooper.setMessageLogging(new LogPrinter(Log.DEBUG, ServiceHandler.TAG));
    }
    serviceHandler = new ServiceHandler(serviceLooper);
    localBroadcastManager = LocalBroadcastManager.getInstance(this);
}
 
Example #21
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private void addActivity(PackageParser.Activity a, String type,
        List<PackageParser.ActivityIntentInfo> newIntents) {
    mActivities.put(a.getComponentName(), a);
    if (DEBUG_SHOW_INFO) {
        final CharSequence label = a.info.nonLocalizedLabel != null
                ? a.info.nonLocalizedLabel
                : a.info.name;
        Log.v(TAG, "  " + type + " " + label + ":");
    }
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "    Class=" + a.info.name);
    }
    final int intentsSize = a.intents.size();
    for (int j = 0; j < intentsSize; j++) {
        PackageParser.ActivityIntentInfo intent = a.intents.get(j);
        if (newIntents != null && "activity".equals(type)) {
            newIntents.add(intent);
        }
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        if (!intent.debugCheck()) {
            Log.w(TAG, "==> For Activity " + a.info.name);
        }
        addFilter(intent);
    }
}
 
Example #22
Source File: BaseDetectionEngine.java    From android-overlay-protection with Apache License 2.0 4 votes vote down vote up
@Override
public void handleEvent(AccessibilityEvent event) {
    // Avoid processing events when screen is locked
    if (_keyguardManager != null) {
        boolean locked = _keyguardManager.inKeyguardRestrictedInputMode();
        if (locked) {
            Log.i(TAG, "Screen locked, skipping overlay check!");
            return;
        }
    }

    Log.d(TAG, String.format("New event %s", event.toString()));
    _eventCounter.newEvent();
    _notifyService.updateNotificationCount(_eventCounter.getLastMinuteEventCount());
    if (_resultReceiver != null) {
        Bundle bundle = new Bundle();
        bundle.putLong("eventCount", _eventCounter.getLastMinuteEventCount());
        _resultReceiver.send(ServiceCommunication.MSG_EVENT_COUNT_UPDATE, bundle);
    }


    // When overlay is detected avoid performing useless computation
    if (_overlayState.isHasOverlay() || _overlayState.isPendingUninstall())
        return;

    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        if (event.getPackageName() == null)
            return;

        String eventPackage = event.getPackageName().toString();
        ComponentName componentName = new ComponentName(
                eventPackage,
                event.getClassName().toString()
        );
        ActivityInfo activityInfo = tryGetActivity(componentName);
        boolean isActivity = activityInfo != null;
        if (isActivity) {
            LogPrinter logPrinter = new LogPrinter(Log.DEBUG, TAG);
            activityInfo.dump(logPrinter, "");
        }
        String className = event.getClassName().toString();

        // Perform detection
        boolean parentAvailable = event.getSource() != null ? event.getSource().getParent() != null : false;

        Log.d(TAG, String.format("Collected info isActivity %s, parentAvailable: %s", String.valueOf(isActivity), String.valueOf(parentAvailable)));

        if (_overlayState.getIgnoreOncePackage().equals(eventPackage)) {
            Log.d(TAG, String.format("Package %s ignored once", eventPackage));
        } else if (eventPackage.equals(previousEventPackage)) {
            Log.d(TAG, String.format("Last two event have the same package %s, skipping check!", eventPackage));
        } else if (_layoutClasses.contains(className) && !isActivity && !parentAvailable) {
            Log.d(TAG, String.format("Detected suspicious class %s without activity and parent for process %s, checking whitelist", className, eventPackage));
            if (!checkWhitelistHit(eventPackage)) {
                Log.d(TAG, "No whitelist entry found");
                if (checkSuspectedApps(eventPackage)) {
                    Log.d(TAG, String.format("******* VIEW OVERLAY DETECTED!!!"));
                    _overlayState.setOffender(eventPackage);
                    _overlayState.setProcess(_currentProcess);
                    _notifyService.processOverlayState(_overlayState);
                }
            } else {
                Log.d(TAG, "Whitelist hit skipping!");
            }
        } else if (isActivity && activityInfo.launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE && !parentAvailable) {
            Log.d(TAG, String.format("Detected suspicious activity %s with single instance flag, checking whitelist", activityInfo.packageName));
            if (!checkWhitelistHit(eventPackage)) {
                Log.d(TAG, "No whitelist entry found");
                if (checkSuspectedApps(eventPackage)) {
                    Log.d(TAG, String.format("******* ACTIVITY OVERLAY DETECTED!!!"));
                    _overlayState.setOffender(eventPackage);
                    _overlayState.setProcess(_currentProcess);
                    _notifyService.processOverlayState(_overlayState);
                }
            } else {
                Log.d(TAG, "Whitelist hit skipping!");
            }
        }
        previousEventPackage = eventPackage;
    }
}