android.util.Slog Java Examples

The following examples show how to use android.util.Slog. 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: Notifier.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Called when there has been user activity.
 */
public void onUserActivity(int event, int uid) {
    if (DEBUG) {
        Slog.d(TAG, "onUserActivity: event=" + event + ", uid=" + uid);
    }

    try {
        mBatteryStats.noteUserActivity(uid, event);
    } catch (RemoteException ex) {
        // Ignore
    }

    synchronized (mLock) {
        if (!mUserActivityPending) {
            mUserActivityPending = true;
            Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY);
            msg.setAsynchronous(true);
            mHandler.sendMessage(msg);
        }
    }
}
 
Example #2
Source File: NetworkStatsObservers.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Removes a {@link DataUsageRequest} if the calling uid is authorized.
 * Should only be called from the handler thread otherwise there will be a race condition
 * on mDataUsageRequests.
 */
private void handleUnregister(DataUsageRequest request, int callingUid) {
    RequestInfo requestInfo;
    requestInfo = mDataUsageRequests.get(request.requestId);
    if (requestInfo == null) {
        if (LOGV) Slog.v(TAG, "Trying to unregister unknown request " + request);
        return;
    }
    if (Process.SYSTEM_UID != callingUid && requestInfo.mCallingUid != callingUid) {
        Slog.w(TAG, "Caller uid " + callingUid + " is not owner of " + request);
        return;
    }

    if (LOGV) Slog.v(TAG, "Unregistering " + request);
    mDataUsageRequests.remove(request.requestId);
    requestInfo.unlinkDeathRecipient();
    requestInfo.callCallback(NetworkStatsManager.CALLBACK_RELEASED);
}
 
Example #3
Source File: JobSchedulerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
int executeTimeoutCommand(PrintWriter pw, String pkgName, int userId,
        boolean hasJobId, int jobId) {
    if (DEBUG) {
        Slog.v(TAG, "executeTimeoutCommand(): " + pkgName + "/" + userId + " " + jobId);
    }

    synchronized (mLock) {
        boolean foundSome = false;
        for (int i=0; i<mActiveServices.size(); i++) {
            final JobServiceContext jc = mActiveServices.get(i);
            final JobStatus js = jc.getRunningJobLocked();
            if (jc.timeoutIfExecutingLocked(pkgName, userId, hasJobId, jobId, "shell")) {
                foundSome = true;
                pw.print("Timing out: ");
                js.printUniqueId(pw);
                pw.print(" ");
                pw.println(js.getServiceComponent().flattenToShortString());
            }
        }
        if (!foundSome) {
            pw.println("No matching executing jobs found.");
        }
    }
    return 0;
}
 
Example #4
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override // Binder call
public String getCurrentKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier) {

    String key = getLayoutDescriptor(identifier);
    synchronized (mDataStore) {
        String layout = null;
        // try loading it using the layout descriptor if we have it
        layout = mDataStore.getCurrentKeyboardLayout(key);
        if (layout == null && !key.equals(identifier.getDescriptor())) {
            // if it doesn't exist fall back to the device descriptor
            layout = mDataStore.getCurrentKeyboardLayout(identifier.getDescriptor());
        }
        if (DEBUG) {
            Slog.d(TAG, "Loaded keyboard layout id for " + key + " and got "
                    + layout);
        }
        return layout;
    }
}
 
Example #5
Source File: WatchdogDiagnostics.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public static void diagnoseCheckers(final List<HandlerChecker> blockedCheckers) {
    PrintWriter out = new PrintWriter(new LogWriter(Log.WARN, Watchdog.TAG, Log.LOG_ID_SYSTEM),
            true);
    for (int i=0; i<blockedCheckers.size(); i++) {
        Thread blockedThread = blockedCheckers.get(i).getThread();
        if (printAnnotatedStack(blockedThread, out)) {
            continue;
        }

        // Fall back to "regular" stack trace, if necessary.
        Slog.w(Watchdog.TAG, blockedThread.getName() + " stack trace:");
        StackTraceElement[] stackTrace = blockedThread.getStackTrace();
        for (StackTraceElement element : stackTrace) {
            Slog.w(Watchdog.TAG, "    at " + element);
        }
    }
}
 
Example #6
Source File: ActivityThread.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private void handleDestroyBackupAgent(CreateBackupAgentData data) {
    if (DEBUG_BACKUP) Slog.v(TAG, "handleDestroyBackupAgent: " + data);

    LoadedApk packageInfo = getPackageInfoNoCheck(data.appInfo, data.compatInfo);
    String packageName = packageInfo.mPackageName;
    BackupAgent agent = mBackupAgents.get(packageName);
    if (agent != null) {
        try {
            agent.onDestroy();
        } catch (Exception e) {
            Slog.w(TAG, "Exception thrown in onDestroy by backup agent of " + data.appInfo);
            e.printStackTrace();
        }
        mBackupAgents.remove(packageName);
    } else {
        Slog.w(TAG, "Attempt to destroy unknown backup agent " + data);
    }
}
 
Example #7
Source File: FingerprintService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void removeClient(ClientMonitor client) {
    if (client != null) {
        client.destroy();
        if (client != mCurrentClient && mCurrentClient != null) {
            Slog.w(TAG, "Unexpected client: " + client.getOwnerString() + "expected: "
                    + mCurrentClient != null ? mCurrentClient.getOwnerString() : "null");
        }
    }
    if (mCurrentClient != null) {
        if (DEBUG) Slog.v(TAG, "Done with client: " + client.getOwnerString());
        mCurrentClient = null;
    }
    if (mPendingClient == null) {
        notifyClientActiveCallbacks(false);
    }
}
 
Example #8
Source File: BroadcastQueue.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
final void logBroadcastReceiverDiscardLocked(BroadcastRecord r) {
    final int logIndex = r.nextReceiver - 1;
    if (logIndex >= 0 && logIndex < r.receivers.size()) {
        Object curReceiver = r.receivers.get(logIndex);
        if (curReceiver instanceof BroadcastFilter) {
            BroadcastFilter bf = (BroadcastFilter) curReceiver;
            EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_FILTER,
                    bf.owningUserId, System.identityHashCode(r),
                    r.intent.getAction(), logIndex, System.identityHashCode(bf));
        } else {
            ResolveInfo ri = (ResolveInfo) curReceiver;
            EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_APP,
                    UserHandle.getUserId(ri.activityInfo.applicationInfo.uid),
                    System.identityHashCode(r), r.intent.getAction(), logIndex, ri.toString());
        }
    } else {
        if (logIndex < 0) Slog.w(TAG,
                "Discarding broadcast before first receiver is invoked: " + r);
        EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_APP,
                -1, System.identityHashCode(r),
                r.intent.getAction(),
                r.nextReceiver,
                "NONE");
    }
}
 
Example #9
Source File: AlarmManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
        if (DEBUG_BATCH) {
            Slog.v(TAG, "Received TIME_TICK alarm; rescheduling");
        }
        synchronized (mLock) {
            mLastTickReceived = System.currentTimeMillis();
        }
        scheduleTimeTickEvent();
    } else if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED)) {
        // Since the kernel does not keep track of DST, we need to
        // reset the TZ information at the beginning of each day
        // based off of the current Zone gmt offset + userspace tracked
        // daylight savings information.
        TimeZone zone = TimeZone.getTimeZone(SystemProperties.get(TIMEZONE_PROPERTY));
        int gmtOffset = zone.getOffset(System.currentTimeMillis());
        setKernelTimezone(mNativeData, -(gmtOffset / 60000));
        scheduleDateChangedEvent();
    }
}
 
Example #10
Source File: EventConditionProvider.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onBootComplete() {
    if (DEBUG) Slog.d(TAG, "onBootComplete");
    if (mBootComplete) return;
    mBootComplete = true;
    final IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_MANAGED_PROFILE_ADDED);
    filter.addAction(Intent.ACTION_MANAGED_PROFILE_REMOVED);
    mContext.registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            reloadTrackers();
        }
    }, filter);
    reloadTrackers();
}
 
Example #11
Source File: MediaRouterService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void restoreRoute(int uid) {
    ClientRecord clientRecord = null;
    synchronized (mLock) {
        UserRecord userRecord = mUserRecords.get(UserHandle.getUserId(uid));
        if (userRecord != null && userRecord.mClientRecords != null) {
            for (ClientRecord cr : userRecord.mClientRecords) {
                if (validatePackageName(uid, cr.mPackageName)) {
                    clientRecord = cr;
                    break;
                }
            }
        }
    }
    if (clientRecord != null) {
        try {
            clientRecord.mClient.onRestoreRoute();
        } catch (RemoteException e) {
            Slog.w(TAG, "Failed to call onRestoreRoute. Client probably died.");
        }
    } else {
        restoreBluetoothA2dp();
    }
}
 
Example #12
Source File: WallpaperManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * We can easily change theme by modified colors hint. This function will check
 * current theme mode and return the WallpaperColors fit current theme mode.
 * If color need modified, it will return a copied WallpaperColors which
 * its ColorsHint is modified to fit current theme mode.
 *
 * @param colors a wallpaper primary colors representation
 */
private WallpaperColors getThemeColorsLocked(WallpaperColors colors) {
    if (colors == null) {
        Slog.w(TAG, "Cannot get theme colors because WallpaperColors is null.");
        return null;
    }

    int colorHints = colors.getColorHints();
    boolean supportDarkTheme = (colorHints & WallpaperColors.HINT_SUPPORTS_DARK_THEME) != 0;
    if (mThemeMode == Settings.Secure.THEME_MODE_WALLPAPER ||
            (mThemeMode == Settings.Secure.THEME_MODE_LIGHT && !supportDarkTheme) ||
            (mThemeMode == Settings.Secure.THEME_MODE_DARK && supportDarkTheme)) {
        return colors;
    }

    WallpaperColors themeColors = new WallpaperColors(colors.getPrimaryColor(),
            colors.getSecondaryColor(), colors.getTertiaryColor());

    if (mThemeMode == Settings.Secure.THEME_MODE_LIGHT) {
        colorHints &= ~WallpaperColors.HINT_SUPPORTS_DARK_THEME;
    } else if (mThemeMode == Settings.Secure.THEME_MODE_DARK) {
        colorHints |= WallpaperColors.HINT_SUPPORTS_DARK_THEME;
    }
    themeColors.setColorHints(colorHints);
    return themeColors;
}
 
Example #13
Source File: PinnerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Open a pin metadata file in the zip if one is present.
 *
 * @param zipFile Zip file to search
 * @return Open input stream or null on any error
 */
private static InputStream maybeOpenPinMetaInZip(ZipFile zipFile, String fileName) {
    ZipEntry pinMetaEntry = zipFile.getEntry(PIN_META_FILENAME);
    InputStream pinMetaStream = null;
    if (pinMetaEntry != null) {
        try {
            pinMetaStream = zipFile.getInputStream(pinMetaEntry);
        } catch (IOException ex) {
            Slog.w(TAG,
                   String.format("error reading pin metadata \"%s\": pinning as blob",
                                 fileName),
                   ex);
        }
    }
    return pinMetaStream;
}
 
Example #14
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void stopServiceLocked(ServiceRecord service) {
    if (service.delayed) {
        // If service isn't actually running, but is is being held in the
        // delayed list, then we need to keep it started but note that it
        // should be stopped once no longer delayed.
        if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "Delaying stop of pending: " + service);
        service.delayedStop = true;
        return;
    }
    synchronized (service.stats.getBatteryStats()) {
        service.stats.stopRunningLocked();
    }
    service.startRequested = false;
    if (service.tracker != null) {
        service.tracker.setStarted(false, mAm.mProcessStats.getMemFactorLocked(),
                SystemClock.uptimeMillis());
    }
    service.callStart = false;
    bringDownServiceIfNeededLocked(service, false, false);
}
 
Example #15
Source File: ImmersiveModeConfirmation.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void immersiveModeChangedLw(String pkg, boolean isImmersiveMode,
        boolean userSetupComplete, boolean navBarEmpty) {
    mHandler.removeMessages(H.SHOW);
    if (isImmersiveMode) {
        final boolean disabled = PolicyControl.disableImmersiveConfirmation(pkg);
        if (DEBUG) Slog.d(TAG, String.format("immersiveModeChanged() disabled=%s mConfirmed=%s",
                disabled, mConfirmed));
        if (!disabled
                && (DEBUG_SHOW_EVERY_TIME || !mConfirmed)
                && userSetupComplete
                && !mVrModeEnabled
                && !navBarEmpty
                && !UserManager.isDeviceInDemoMode(mContext)
                && (mLockTaskState != LOCK_TASK_MODE_LOCKED)) {
            mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs);
        }
    } else {
        mHandler.sendEmptyMessage(H.HIDE);
    }
}
 
Example #16
Source File: HdmiControlService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void setStandbyMode(boolean isStandbyModeOn) {
    assertRunOnServiceThread();
    if (isPowerOnOrTransient() && isStandbyModeOn) {
        mPowerManager.goToSleep(SystemClock.uptimeMillis(),
                PowerManager.GO_TO_SLEEP_REASON_HDMI, 0);
        if (playback() != null) {
            playback().sendStandby(0 /* unused */);
        }
    } else if (isPowerStandbyOrTransient() && !isStandbyModeOn) {
        mPowerManager.wakeUp(SystemClock.uptimeMillis(), "android.server.hdmi:WAKE");
        if (playback() != null) {
            oneTouchPlay(new IHdmiControlCallback.Stub() {
                @Override
                public void onComplete(int result) {
                    if (result != HdmiControlManager.RESULT_SUCCESS) {
                        Slog.w(TAG, "Failed to complete 'one touch play'. result=" + result);
                    }
                }
            });
        }
    }
}
 
Example #17
Source File: SystemServiceManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void cleanupUser(final int userHandle) {
    Slog.i(TAG, "Calling onCleanupUser u" + userHandle);
    final int serviceLen = mServices.size();
    for (int i = 0; i < serviceLen; i++) {
        final SystemService service = mServices.get(i);
        Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "onCleanupUser "
                + service.getClass().getName());
        long time = SystemClock.elapsedRealtime();
        try {
            service.onCleanupUser(userHandle);
        } catch (Exception ex) {
            Slog.wtf(TAG, "Failure reporting cleanup of user " + userHandle
                    + " to service " + service.getClass().getName(), ex);
        }
        warnIfTooLong(SystemClock.elapsedRealtime() - time, service, "onCleanupUser");
        Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
    }
}
 
Example #18
Source File: DreamService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Stops the dream and detaches from the window.
 * <p>
 * When the dream ends, the system will be allowed to go to sleep fully unless there
 * is a reason for it to be awake such as recent user activity or wake locks being held.
 * </p>
 */
public final void finish() {
    if (mDebug) Slog.v(TAG, "finish(): mFinished=" + mFinished);

    if (!mFinished) {
        mFinished = true;

        if (mWindowToken == null) {
            Slog.w(TAG, "Finish was called before the dream was attached.");
        } else {
            try {
                mSandman.finishSelf(mWindowToken, true /*immediate*/);
            } catch (RemoteException ex) {
                // system server died
            }
        }

        stopSelf(); // if launched via any other means
    }
}
 
Example #19
Source File: UserManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Removes a user and all data directories created for that user. This method should be called
 * after the user's processes have been terminated.
 * @param userHandle the user's id
 */
@Override
public boolean removeUser(int userHandle) {
    Slog.i(LOG_TAG, "removeUser u" + userHandle);
    checkManageOrCreateUsersPermission("Only the system can remove users");

    final boolean isManagedProfile;
    synchronized (mUsersLock) {
        UserInfo userInfo = getUserInfoLU(userHandle);
        isManagedProfile = userInfo != null && userInfo.isManagedProfile();
    }
    String restriction = isManagedProfile
            ? UserManager.DISALLOW_REMOVE_MANAGED_PROFILE : UserManager.DISALLOW_REMOVE_USER;
    if (getUserRestrictions(UserHandle.getCallingUserId()).getBoolean(restriction, false)) {
        Log.w(LOG_TAG, "Cannot remove user. " + restriction + " is enabled.");
        return false;
    }
    return removeUserUnchecked(userHandle);
}
 
Example #20
Source File: ContentService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@GuardedBy("mCache")
private void invalidateCacheLocked(int userId, String providerPackageName, Uri uri) {
    ArrayMap<String, ArrayMap<Pair<String, Uri>, Bundle>> userCache = mCache.get(userId);
    if (userCache == null) return;

    ArrayMap<Pair<String, Uri>, Bundle> packageCache = userCache.get(providerPackageName);
    if (packageCache == null) return;

    if (uri != null) {
        for (int i = 0; i < packageCache.size();) {
            final Pair<String, Uri> key = packageCache.keyAt(i);
            if (key.second != null && key.second.toString().startsWith(uri.toString())) {
                if (DEBUG) Slog.d(TAG, "Invalidating cache for key " + key);
                packageCache.removeAt(i);
            } else {
                i++;
            }
        }
    } else {
        if (DEBUG) Slog.d(TAG, "Invalidating cache for package " + providerPackageName);
        packageCache.clear();
    }
}
 
Example #21
Source File: DisplayWindowController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Positions the task stack at the given position in the task stack container.
 */
public void positionChildAt(StackWindowController child, int position) {
    synchronized (mWindowMap) {
        if (DEBUG_STACK) Slog.i(TAG_WM, "positionTaskStackAt: positioning stack=" + child
                + " at " + position);
        if (mContainer == null) {
            if (DEBUG_STACK) Slog.i(TAG_WM,
                    "positionTaskStackAt: could not find display=" + mContainer);
            return;
        }
        if (child.mContainer == null) {
            if (DEBUG_STACK) Slog.i(TAG_WM,
                    "positionTaskStackAt: could not find stack=" + this);
            return;
        }
        mContainer.positionStackAt(position, child.mContainer);
    }
}
 
Example #22
Source File: WallpaperManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onPackageUpdateFinished(String packageName, int uid) {
    synchronized (mLock) {
        if (mCurrentUserId != getChangingUserId()) {
            return;
        }
        WallpaperData wallpaper = mWallpaperMap.get(mCurrentUserId);
        if (wallpaper != null) {
            final ComponentName wpService = wallpaper.wallpaperComponent;
            if (wpService != null && wpService.getPackageName().equals(packageName)) {
                if (DEBUG_LIVE) {
                    Slog.i(TAG, "Wallpaper " + wpService + " update has finished");
                }
                wallpaper.wallpaperUpdating = false;
                clearWallpaperComponentLocked(wallpaper);
                if (!bindWallpaperComponentLocked(wpService, false, false,
                        wallpaper, null)) {
                    Slog.w(TAG, "Wallpaper " + wpService
                            + " no longer available; reverting to default");
                    clearWallpaperLocked(false, FLAG_SYSTEM, wallpaper.userId, null);
                }
            }
        }
    }
}
 
Example #23
Source File: KeyguardServiceWrapper.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder interface
public void dismiss(IKeyguardDismissCallback callback, CharSequence message) {
    try {
        mService.dismiss(callback, message);
    } catch (RemoteException e) {
        Slog.w(TAG , "Remote Exception", e);
    }
}
 
Example #24
Source File: DeviceIdleController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@GuardedBy("this")
private void onAppRemovedFromTempWhitelistLocked(int appId, String reason) {
    if (DEBUG) {
        Slog.d(TAG, "Removing appId " + appId + " from temp whitelist");
    }
    updateTempWhitelistAppIdsLocked(appId, false);
    mHandler.obtainMessage(MSG_REPORT_TEMP_APP_WHITELIST_CHANGED, appId, 0)
            .sendToTarget();
    reportTempWhitelistChangedLocked();
    try {
        mBatteryStats.noteEvent(BatteryStats.HistoryItem.EVENT_TEMP_WHITELIST_FINISH,
                reason, appId);
    } catch (RemoteException e) {
    }
}
 
Example #25
Source File: DisplayContent.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void onWindowFreezeTimeout() {
    Slog.w(TAG_WM, "Window freeze timeout expired.");
    mService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_TIMEOUT;

    forAllWindows(w -> {
        if (!w.getOrientationChanging()) {
            return;
        }
        w.orientationChangeTimedOut();
        w.mLastFreezeDuration = (int)(SystemClock.elapsedRealtime()
                - mService.mDisplayFreezeTime);
        Slog.w(TAG_WM, "Force clearing orientation change: " + w);
    }, true /* traverseTopToBottom */);
    mService.mWindowPlacerLocked.performSurfacePlacement();
}
 
Example #26
Source File: BluetoothManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean bindBluetoothProfileService(int bluetoothProfile,
        IBluetoothProfileServiceConnection proxy) {
    if (!mEnable) {
        if (DBG) {
            Slog.d(TAG, "Trying to bind to profile: " + bluetoothProfile
                    + ", while Bluetooth was disabled");
        }
        return false;
    }
    synchronized (mProfileServices) {
        ProfileServiceConnections psc = mProfileServices.get(new Integer(bluetoothProfile));
        if (psc == null) {
            if (DBG) {
                Slog.d(TAG, "Creating new ProfileServiceConnections object for" + " profile: "
                        + bluetoothProfile);
            }

            if (bluetoothProfile != BluetoothProfile.HEADSET) {
                return false;
            }

            Intent intent = new Intent(IBluetoothHeadset.class.getName());
            psc = new ProfileServiceConnections(intent);
            if (!psc.bindService()) {
                return false;
            }

            mProfileServices.put(new Integer(bluetoothProfile), psc);
        }
    }

    // Introducing a delay to give the client app time to prepare
    Message addProxyMsg = mHandler.obtainMessage(MESSAGE_ADD_PROXY_DELAYED);
    addProxyMsg.arg1 = bluetoothProfile;
    addProxyMsg.obj = proxy;
    mHandler.sendMessageDelayed(addProxyMsg, ADD_PROXY_DELAY_MS);
    return true;
}
 
Example #27
Source File: OverlayManagerServiceImpl.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void onTargetPackageRemoved(@NonNull final String packageName, final int userId) {
    if (DEBUG) {
        Slog.d(TAG, "onTargetPackageRemoved packageName=" + packageName + " userId=" + userId);
    }

    if (updateAllOverlaysForTarget(packageName, userId, 0)) {
        mListener.onOverlaysChanged(packageName, userId);
    }
}
 
Example #28
Source File: WifiDisplayController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if (action.equals(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION)) {
        // This broadcast is sticky so we'll always get the initial Wifi P2P state
        // on startup.
        boolean enabled = (intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE,
                WifiP2pManager.WIFI_P2P_STATE_DISABLED)) ==
                WifiP2pManager.WIFI_P2P_STATE_ENABLED;
        if (DEBUG) {
            Slog.d(TAG, "Received WIFI_P2P_STATE_CHANGED_ACTION: enabled="
                    + enabled);
        }

        handleStateChanged(enabled);
    } else if (action.equals(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION)) {
        if (DEBUG) {
            Slog.d(TAG, "Received WIFI_P2P_PEERS_CHANGED_ACTION.");
        }

        handlePeersChanged();
    } else if (action.equals(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION)) {
        NetworkInfo networkInfo = (NetworkInfo)intent.getParcelableExtra(
                WifiP2pManager.EXTRA_NETWORK_INFO);
        if (DEBUG) {
            Slog.d(TAG, "Received WIFI_P2P_CONNECTION_CHANGED_ACTION: networkInfo="
                    + networkInfo);
        }

        handleConnectionChanged(networkInfo);
    } else if (action.equals(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION)) {
        mThisDevice = (WifiP2pDevice) intent.getParcelableExtra(
                WifiP2pManager.EXTRA_WIFI_P2P_DEVICE);
        if (DEBUG) {
            Slog.d(TAG, "Received WIFI_P2P_THIS_DEVICE_CHANGED_ACTION: mThisDevice= "
                    + mThisDevice);
        }
    }
}
 
Example #29
Source File: ImmersiveModeConfirmation.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void handleHide() {
    if (mClingWindow != null) {
        if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation");
        mWindowManager.removeView(mClingWindow);
        mClingWindow = null;
    }
}
 
Example #30
Source File: NsdService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean requestLimitReached(ClientInfo clientInfo) {
    if (clientInfo.mClientIds.size() >= ClientInfo.MAX_LIMIT) {
        if (DBG) Slog.d(TAG, "Exceeded max outstanding requests " + clientInfo);
        return true;
    }
    return false;
}