Java Code Examples for android.util.Slog#e()

The following examples show how to use android.util.Slog#e() . 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: TvInputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onTimeShiftCurrentPositionChanged(long timeMs) {
    synchronized (mLock) {
        if (DEBUG) {
            Slog.d(TAG, "onTimeShiftCurrentPositionChanged(timeMs=" + timeMs + ")");
        }
        if (mSessionState.session == null || mSessionState.client == null) {
            return;
        }
        try {
            mSessionState.client.onTimeShiftCurrentPositionChanged(timeMs,
                    mSessionState.seq);
        } catch (RemoteException e) {
            Slog.e(TAG, "error in onTimeShiftCurrentPositionChanged", e);
        }
    }
}
 
Example 2
Source File: TvInputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void startRecording(IBinder sessionToken, @Nullable Uri programUri, int userId) {
    final int callingUid = Binder.getCallingUid();
    final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid,
            userId, "startRecording");
    final long identity = Binder.clearCallingIdentity();
    try {
        synchronized (mLock) {
            try {
                getSessionLocked(sessionToken, callingUid, resolvedUserId).startRecording(
                        programUri);
            } catch (RemoteException | SessionNotFoundException e) {
                Slog.e(TAG, "error in startRecording", e);
            }
        }
    } finally {
        Binder.restoreCallingIdentity(identity);
    }
}
 
Example 3
Source File: TvInputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void timeShiftEnablePositionTracking(IBinder sessionToken, boolean enable,
        int userId) {
    final int callingUid = Binder.getCallingUid();
    final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid,
            userId, "timeShiftEnablePositionTracking");
    final long identity = Binder.clearCallingIdentity();
    try {
        synchronized (mLock) {
            try {
                getSessionLocked(sessionToken, callingUid, resolvedUserId)
                        .timeShiftEnablePositionTracking(enable);
            } catch (RemoteException | SessionNotFoundException e) {
                Slog.e(TAG, "error in timeShiftEnablePositionTracking", e);
            }
        }
    } finally {
        Binder.restoreCallingIdentity(identity);
    }
}
 
Example 4
Source File: RecentsAnimationController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void cancelAnimation(@ReorderMode int reorderMode, boolean runSynchronously,
        String reason) {
    if (DEBUG_RECENTS_ANIMATIONS) Slog.d(TAG, "cancelAnimation(): reason=" + reason
            + " runSynchronously=" + runSynchronously);
    synchronized (mService.getWindowManagerLock()) {
        if (mCanceled) {
            // We've already canceled the animation
            return;
        }
        mService.mH.removeCallbacks(mFailsafeRunnable);
        mCanceled = true;
        try {
            mRunner.onAnimationCanceled();
        } catch (RemoteException e) {
            Slog.e(TAG, "Failed to cancel recents animation", e);
        }
    }

    // Clean up and return to the previous app
    mCallbacks.onAnimationFinished(reorderMode, runSynchronously);
}
 
Example 5
Source File: MediaSessionRecord.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void pause(String packageName, int pid, int uid, ISessionControllerCallback caller) {
    try {
        mCb.onPause(packageName, pid, uid, caller);
    } catch (RemoteException e) {
        Slog.e(TAG, "Remote failure in pause.", e);
    }
}
 
Example 6
Source File: StatsCompanionService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
    mStatsCompanionService = new StatsCompanionService(getContext());
    try {
        publishBinderService(Context.STATS_COMPANION_SERVICE, mStatsCompanionService);
        if (DEBUG) Slog.d(TAG, "Published " + Context.STATS_COMPANION_SERVICE);
    } catch (Exception e) {
        Slog.e(TAG, "Failed to publishBinderService", e);
    }
}
 
Example 7
Source File: ActiveSourceHandler.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
static ActiveSourceHandler create(HdmiCecLocalDeviceTv source, IHdmiControlCallback callback) {
    if (source == null) {
        Slog.e(TAG, "Wrong arguments");
        return null;
    }
    return new ActiveSourceHandler(source, callback);
}
 
Example 8
Source File: LoadedApk.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private AppComponentFactory createAppFactory(ApplicationInfo appInfo, ClassLoader cl) {
    if (appInfo.appComponentFactory != null && cl != null) {
        try {
            return (AppComponentFactory) cl.loadClass(appInfo.appComponentFactory)
                    .newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            Slog.e(TAG, "Unable to instantiate appComponentFactory", e);
        }
    }
    return AppComponentFactory.DEFAULT;
}
 
Example 9
Source File: PinnedStackController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void notifyShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) {
    if (mPinnedStackListener != null) {
        try {
            mPinnedStackListener.onShelfVisibilityChanged(shelfVisible, shelfHeight);
        } catch (RemoteException e) {
            Slog.e(TAG_WM, "Error delivering bounds changed event.", e);
        }
    }
}
 
Example 10
Source File: TvRemoteService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void openInputBridgeInternalLocked(TvRemoteProviderProxy provider, IBinder token,
                                           String name, int width, int height,
                                           int maxPointers) {
    if (DEBUG) {
        Slog.d(TAG, "openInputBridgeInternalLocked(), token: " + token + ", name: " + name +
                ", width: " + width + ", height: " + height + ", maxPointers: " + maxPointers);
    }

    try {
        //Create a new bridge, if one does not exist already
        if (mBridgeMap.containsKey(token)) {
            if (DEBUG) Slog.d(TAG, "RemoteBridge already exists");
            // Respond back with success.
            informInputBridgeConnected(token);
            return;
        }

        UinputBridge inputBridge = new UinputBridge(token, name, width, height, maxPointers);

        mBridgeMap.put(token, inputBridge);
        mProviderMap.put(token, provider);

        // Respond back with success.
        informInputBridgeConnected(token);

    } catch (IOException ioe) {
        Slog.e(TAG, "Cannot create device for " + name);
    }
}
 
Example 11
Source File: BrightnessTracker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void writeAmbientBrightnessStats() {
    final AtomicFile writeTo = mInjector.getFile(AMBIENT_BRIGHTNESS_STATS_FILE);
    if (writeTo == null) {
        return;
    }
    FileOutputStream output = null;
    try {
        output = writeTo.startWrite();
        mAmbientBrightnessStatsTracker.writeStats(output);
        writeTo.finishWrite(output);
    } catch (IOException e) {
        writeTo.failWrite(output);
        Slog.e(TAG, "Failed to write ambient brightness stats.", e);
    }
}
 
Example 12
Source File: RadioModule.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public android.hardware.radio.ICloseHandle addAnnouncementListener(@NonNull int[] enabledTypes,
        @NonNull android.hardware.radio.IAnnouncementListener listener) throws RemoteException {
    ArrayList<Byte> enabledList = new ArrayList<>();
    for (int type : enabledTypes) {
        enabledList.add((byte)type);
    }

    MutableInt halResult = new MutableInt(Result.UNKNOWN_ERROR);
    Mutable<ICloseHandle> hwCloseHandle = new Mutable<>();
    IAnnouncementListener hwListener = new IAnnouncementListener.Stub() {
        public void onListUpdated(ArrayList<Announcement> hwAnnouncements)
                throws RemoteException {
            listener.onListUpdated(hwAnnouncements.stream().
                map(a -> Convert.announcementFromHal(a)).collect(Collectors.toList()));
        }
    };

    synchronized (mService) {
        mService.registerAnnouncementListener(enabledList, hwListener, (result, closeHnd) -> {
            halResult.value = result;
            hwCloseHandle.value = closeHnd;
        });
    }
    Convert.throwOnError("addAnnouncementListener", halResult.value);

    return new android.hardware.radio.ICloseHandle.Stub() {
        public void close() {
            try {
                hwCloseHandle.value.close();
            } catch (RemoteException ex) {
                Slog.e(TAG, "Failed closing announcement listener", ex);
            }
        }
    };
}
 
Example 13
Source File: RemoteDisplayProviderProxy.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void adjustVolume(String id, int volume) {
    try {
        mProvider.adjustVolume(id, volume);
    } catch (RemoteException ex) {
        Slog.e(TAG, "Failed to deliver request to adjust display volume.", ex);
    }
}
 
Example 14
Source File: WindowSurfaceController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void setMatrix(SurfaceControl.Transaction t, float dsdx, float dtdx,
        float dtdy, float dsdy, boolean recoveringMemory) {
    final boolean matrixChanged = mLastDsdx != dsdx || mLastDtdx != dtdx ||
                                  mLastDtdy != dtdy || mLastDsdy != dsdy;
    if (!matrixChanged) {
        return;
    }

    mLastDsdx = dsdx;
    mLastDtdx = dtdx;
    mLastDtdy = dtdy;
    mLastDsdy = dsdy;

    try {
        if (SHOW_TRANSACTIONS) logSurface(
                "MATRIX [" + dsdx + "," + dtdx + "," + dtdy + "," + dsdy + "]", null);
        if (t == null) {
            mSurfaceControl.setMatrix(dsdx, dtdx, dtdy, dsdy);
        } else {
            t.setMatrix(mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
        }
    } catch (RuntimeException e) {
        // If something goes wrong with the surface (such
        // as running out of memory), don't take down the
        // entire system.
        Slog.e(TAG, "Error setting matrix on surface surface" + title
                + " MATRIX [" + dsdx + "," + dtdx + "," + dtdy + "," + dsdy + "]", null);
        if (!recoveringMemory) {
            mAnimator.reclaimSomeSurfaceMemory("matrix", true);
        }
    }
}
 
Example 15
Source File: PersistentConnection.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@GuardedBy("mLock")
public final void bindInnerLocked(boolean resetBackoff) {
    unscheduleRebindLocked();

    if (mBound) {
        return;
    }
    mBound = true;

    if (resetBackoff) {
        // Note this is the only place we reset the backoff time.
        mNextBackoffMs = mRebindBackoffMs;
    }

    final Intent service = new Intent().setComponent(mComponentName);

    if (DEBUG) {
        Slog.d(mTag, "Attempting to connect to " + mComponentName);
    }

    final boolean success = mContext.bindServiceAsUser(service, mServiceConnection,
            Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,
            mHandler, UserHandle.of(mUserId));

    if (!success) {
        Slog.e(mTag, "Binding: " + service.getComponent() + " u" + mUserId
                + " failed.");
    }
}
 
Example 16
Source File: HdmiControlService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
boolean invokeVendorCommandListenersOnControlStateChanged(boolean enabled, int reason) {
    synchronized (mLock) {
        if (mVendorCommandListenerRecords.isEmpty()) {
            return false;
        }
        for (VendorCommandListenerRecord record : mVendorCommandListenerRecords) {
            try {
                record.mListener.onControlStateChanged(enabled, reason);
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to notify control-state-changed to vendor handler", e);
            }
        }
        return true;
    }
}
 
Example 17
Source File: BluetoothManagerService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private void recoverBluetoothServiceFromError(boolean clearBle) {
    Slog.e(TAG, "recoverBluetoothServiceFromError");
    try {
        mBluetoothLock.readLock().lock();
        if (mBluetooth != null) {
            //Unregister callback object
            mBluetooth.unregisterCallback(mBluetoothCallback);
        }
    } catch (RemoteException re) {
        Slog.e(TAG, "Unable to unregister", re);
    } finally {
        mBluetoothLock.readLock().unlock();
    }

    SystemClock.sleep(500);

    // disable
    addActiveLog(BluetoothProtoEnums.ENABLE_DISABLE_REASON_START_ERROR,
            mContext.getPackageName(), false);
    handleDisable();

    waitForOnOff(false, true);

    sendBluetoothServiceDownCallback();

    try {
        mBluetoothLock.writeLock().lock();
        if (mBluetooth != null) {
            mBluetooth = null;
            // Unbind
            mContext.unbindService(mConnection);
        }
        mBluetoothGatt = null;
    } finally {
        mBluetoothLock.writeLock().unlock();
    }

    mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
    mState = BluetoothAdapter.STATE_OFF;

    if (clearBle) {
        clearBleApps();
    }

    mEnable = false;

    if (mErrorRecoveryRetryCounter++ < MAX_ERROR_RESTART_RETRIES) {
        // Send a Bluetooth Restart message to reenable bluetooth
        Message restartMsg = mHandler.obtainMessage(MESSAGE_RESTART_BLUETOOTH_SERVICE);
        mHandler.sendMessageDelayed(restartMsg, ERROR_RESTART_TIME_MS);
    } else {
        // todo: notify user to power down and power up phone to make bluetooth work.
    }
}
 
Example 18
Source File: LockdownVpnTracker.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Watch for state changes to both active egress network, kicking off a VPN
 * connection when ready, or setting firewall rules once VPN is connected.
 */
private void handleStateChangedLocked() {

    final NetworkInfo egressInfo = mConnService.getActiveNetworkInfoUnfiltered();
    final LinkProperties egressProp = mConnService.getActiveLinkProperties();

    final NetworkInfo vpnInfo = mVpn.getNetworkInfo();
    final VpnConfig vpnConfig = mVpn.getLegacyVpnConfig();

    // Restart VPN when egress network disconnected or changed
    final boolean egressDisconnected = egressInfo == null
            || State.DISCONNECTED.equals(egressInfo.getState());
    final boolean egressChanged = egressProp == null
            || !TextUtils.equals(mAcceptedEgressIface, egressProp.getInterfaceName());

    final String egressTypeName = (egressInfo == null) ?
            null : ConnectivityManager.getNetworkTypeName(egressInfo.getType());
    final String egressIface = (egressProp == null) ?
            null : egressProp.getInterfaceName();
    Slog.d(TAG, "handleStateChanged: egress=" + egressTypeName +
            " " + mAcceptedEgressIface + "->" + egressIface);

    if (egressDisconnected || egressChanged) {
        mAcceptedEgressIface = null;
        mVpn.stopLegacyVpnPrivileged();
    }
    if (egressDisconnected) {
        hideNotification();
        return;
    }

    final int egressType = egressInfo.getType();
    if (vpnInfo.getDetailedState() == DetailedState.FAILED) {
        EventLogTags.writeLockdownVpnError(egressType);
    }

    if (mErrorCount > MAX_ERROR_COUNT) {
        showNotification(R.string.vpn_lockdown_error, R.drawable.vpn_disconnected);

    } else if (egressInfo.isConnected() && !vpnInfo.isConnectedOrConnecting()) {
        if (mProfile.isValidLockdownProfile()) {
            Slog.d(TAG, "Active network connected; starting VPN");
            EventLogTags.writeLockdownVpnConnecting(egressType);
            showNotification(R.string.vpn_lockdown_connecting, R.drawable.vpn_disconnected);

            mAcceptedEgressIface = egressProp.getInterfaceName();
            try {
                // Use the privileged method because Lockdown VPN is initiated by the system, so
                // no additional permission checks are necessary.
                mVpn.startLegacyVpnPrivileged(mProfile, KeyStore.getInstance(), egressProp);
            } catch (IllegalStateException e) {
                mAcceptedEgressIface = null;
                Slog.e(TAG, "Failed to start VPN", e);
                showNotification(R.string.vpn_lockdown_error, R.drawable.vpn_disconnected);
            }
        } else {
            Slog.e(TAG, "Invalid VPN profile; requires IP-based server and DNS");
            showNotification(R.string.vpn_lockdown_error, R.drawable.vpn_disconnected);
        }

    } else if (vpnInfo.isConnected() && vpnConfig != null) {
        final String iface = vpnConfig.interfaze;
        final List<LinkAddress> sourceAddrs = vpnConfig.addresses;

        if (TextUtils.equals(iface, mAcceptedIface)
              && sourceAddrs.equals(mAcceptedSourceAddr)) {
            return;
        }

        Slog.d(TAG, "VPN connected using iface=" + iface +
                ", sourceAddr=" + sourceAddrs.toString());
        EventLogTags.writeLockdownVpnConnected(egressType);
        showNotification(R.string.vpn_lockdown_connected, R.drawable.vpn_connected);

        final NetworkInfo clone = new NetworkInfo(egressInfo);
        augmentNetworkInfo(clone);
        mConnService.sendConnectedBroadcast(clone);
    }
}
 
Example 19
Source File: SyncOperation.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * All fields are stored in a corresponding key in the persistable bundle.
 *
 * {@link #extras} is a Bundle and can contain parcelable objects. But only the type Account
 * is allowed {@link ContentResolver#validateSyncExtrasBundle(Bundle)} that can't be stored in
 * a PersistableBundle. For every value of type Account with key 'key', we store a
 * PersistableBundle containing account information at key 'ACCOUNT:key'. The Account object
 * can be reconstructed using this.
 *
 * We put a flag with key 'SyncManagerJob', to identify while reconstructing a sync operation
 * from a bundle whether the bundle actually contains information about a sync.
 * @return A persistable bundle containing all information to re-construct the sync operation.
 */
PersistableBundle toJobInfoExtras() {
    // This will be passed as extras bundle to a JobScheduler job.
    PersistableBundle jobInfoExtras = new PersistableBundle();

    PersistableBundle syncExtrasBundle = new PersistableBundle();
    for (String key: extras.keySet()) {
        Object value = extras.get(key);
        if (value instanceof Account) {
            Account account = (Account) value;
            PersistableBundle accountBundle = new PersistableBundle();
            accountBundle.putString("accountName", account.name);
            accountBundle.putString("accountType", account.type);
            // This is stored in jobInfoExtras so that we don't override a user specified
            // sync extra with the same key.
            jobInfoExtras.putPersistableBundle("ACCOUNT:" + key, accountBundle);
        } else if (value instanceof Long) {
            syncExtrasBundle.putLong(key, (Long) value);
        } else if (value instanceof Integer) {
            syncExtrasBundle.putInt(key, (Integer) value);
        } else if (value instanceof Boolean) {
            syncExtrasBundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof Float) {
            syncExtrasBundle.putDouble(key, (double) (float) value);
        } else if (value instanceof Double) {
            syncExtrasBundle.putDouble(key, (Double) value);
        } else if (value instanceof String) {
            syncExtrasBundle.putString(key, (String) value);
        } else if (value == null) {
            syncExtrasBundle.putString(key, null);
        } else {
            Slog.e(TAG, "Unknown extra type.");
        }
    }
    jobInfoExtras.putPersistableBundle("syncExtras", syncExtrasBundle);

    jobInfoExtras.putBoolean("SyncManagerJob", true);

    jobInfoExtras.putString("provider", target.provider);
    jobInfoExtras.putString("accountName", target.account.name);
    jobInfoExtras.putString("accountType", target.account.type);
    jobInfoExtras.putInt("userId", target.userId);
    jobInfoExtras.putInt("owningUid", owningUid);
    jobInfoExtras.putString("owningPackage", owningPackage);
    jobInfoExtras.putInt("reason", reason);
    jobInfoExtras.putInt("source", syncSource);
    jobInfoExtras.putBoolean("allowParallelSyncs", allowParallelSyncs);
    jobInfoExtras.putInt("jobId", jobId);
    jobInfoExtras.putBoolean("isPeriodic", isPeriodic);
    jobInfoExtras.putInt("sourcePeriodicId", sourcePeriodicId);
    jobInfoExtras.putLong("periodMillis", periodMillis);
    jobInfoExtras.putLong("flexMillis", flexMillis);
    jobInfoExtras.putLong("expectedRuntime", expectedRuntime);
    jobInfoExtras.putInt("retries", retries);
    jobInfoExtras.putInt("syncExemptionFlag", syncExemptionFlag);
    return jobInfoExtras;
}
 
Example 20
Source File: AccessibilityInteractionController.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private void requestPreparerTimeoutUiThread() {
    synchronized (mLock) {
        Slog.e(LOG_TAG, "AccessibilityRequestPreparer timed out");
        scheduleAllMessagesWaitingForRequestPreparerLocked();
    }
}