Example usage for android.util Slog d

List of usage examples for android.util Slog d

Introduction

In this page you can find the example usage for android.util Slog d.

Prototype

@UnsupportedAppUsage
    public static int d(String tag, String msg) 

Source Link

Usage

From source file:com.android.providers.downloads.DownloadService.java

/**
 * Removes the local copy of the info about a download.
 *//*from   w ww . j  av  a  2  s  .  c om*/
private void deleteDownloadLocked(long id) {
    DownloadInfo info = mDownloads.get(id);
    if (info.mStatus == Downloads.Impl.STATUS_RUNNING) {
        info.mStatus = Downloads.Impl.STATUS_CANCELED;
    }
    if (info.mStatus != Downloads.Impl.STATUS_SUCCESS && info.mFileName != null) {
        Slog.d(Constants.TAG, "deleteDownloadLocked() deleting " + info.mFileName);
        deleteFileIfExists(info.mFileName + Helpers.sDownloadingExtension);
    }
    mDownloads.remove(info.mId);
}

From source file:com.android.systemui.statusbar.phone.NavigationBarView.java

public void setLowProfile(final boolean lightsOut, final boolean animate, final boolean force) {
    if (!force && lightsOut == mLowProfile)
        return;//from  w  w w .ja v a 2 s  . c om

    mLowProfile = lightsOut;

    if (DEBUG)
        Slog.d(TAG, "setting lights " + (lightsOut ? "out" : "on"));

    final View navButtons = mCurrentView.findViewById(R.id.nav_buttons);
    final View lowLights = mCurrentView.findViewById(R.id.lights_out);

    // ok, everyone, stop it right there
    navButtons.animate().cancel();
    lowLights.animate().cancel();

    if (!animate) {
        navButtons.setAlpha(lightsOut ? 0f : 1f);

        lowLights.setAlpha(lightsOut ? 1f : 0f);
        lowLights.setVisibility(lightsOut ? View.VISIBLE : View.GONE);
    } else {
        navButtons.animate().alpha(lightsOut ? 0f : 1f).setDuration(lightsOut ? 750 : 250).start();

        lowLights.setOnTouchListener(mLightsOutListener);
        if (lowLights.getVisibility() == View.GONE) {
            lowLights.setAlpha(0f);
            lowLights.setVisibility(View.VISIBLE);
        }
        lowLights.animate().alpha(lightsOut ? 1f : 0f).setDuration(lightsOut ? 750 : 250)
                .setInterpolator(new AccelerateInterpolator(2.0f))
                .setListener(lightsOut ? null : new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator _a) {
                        lowLights.setVisibility(View.GONE);
                    }
                }).start();
    }
}

From source file:com.android.systemui.statusbar.phone.NavigationBarView.java

public void setHidden(final boolean hide) {
    if (hide == mHidden)
        return;//from  w w w  .  j  a  v  a2 s .c o  m

    mHidden = hide;
    Slog.d(TAG, (hide ? "HIDING" : "SHOWING") + " navigation bar");

    // bring up the lights no matter what
    setLowProfile(false);
}

From source file:com.android.server.MountService.java

private void updatePublicVolumeState(StorageVolume volume, String state) {
    final String path = volume.getPath();
    final String oldState;
    synchronized (mVolumesLock) {
        oldState = mVolumeStates.put(path, state);
        volume.setState(state);//from  w w w  .j  a  v  a 2s. co  m
    }

    if (state.equals(oldState)) {
        Slog.w(TAG, String.format("Duplicate state transition (%s -> %s) for %s", state, state, path));
        return;
    }

    Slog.d(TAG, "volume state changed for " + path + " (" + oldState + " -> " + state + ")");

    // Tell PackageManager about changes to primary volume state, but only
    // when not emulated.
    if (volume.isPrimary() && !volume.isEmulated()) {
        if (Environment.MEDIA_UNMOUNTED.equals(state)) {
            mPms.updateExternalMediaStatus(false, false);

            /*
             * Some OBBs might have been unmounted when this volume was
             * unmounted, so send a message to the handler to let it know to
             * remove those from the list of mounted OBBS.
             */
            mObbActionHandler.sendMessage(mObbActionHandler.obtainMessage(OBB_FLUSH_MOUNT_STATE, path));
        } else if (Environment.MEDIA_MOUNTED.equals(state)) {
            mPms.updateExternalMediaStatus(true, false);
        }
    }

    synchronized (mListeners) {
        for (int i = mListeners.size() - 1; i >= 0; i--) {
            MountServiceBinderListener bl = mListeners.get(i);
            try {
                bl.mListener.onStorageStateChanged(path, oldState, state);
            } catch (RemoteException rex) {
                Slog.e(TAG, "Listener dead");
                mListeners.remove(i);
            } catch (Exception ex) {
                Slog.e(TAG, "Listener failed", ex);
            }
        }
    }
}

From source file:com.android.systemui.statusbar.phone.NavigationBarView.java

public void reorient() {
    final int rot = mDisplay.getRotation();
    for (int i = 0; i < 4; i++) {
        mRotatedViews[i].setVisibility(View.GONE);
    }//w w  w.ja  va 2s .c om
    if (mTablet_UI != 0) { // this is either a tablet of Phablet.  Need to stay at Rot_0
        mCurrentView = mRotatedViews[Surface.ROTATION_0];
    } else {
        mCurrentView = mRotatedViews[rot];
    }
    //        mCurrentView = mRotatedViews[rot];
    mCurrentView.setVisibility(View.VISIBLE);

    // force the low profile & disabled states into compliance
    setLowProfile(mLowProfile, false, true /* force */);
    setDisabledFlags(mDisabledFlags, true /* force */);
    setMenuVisibility(mShowMenu, true /* force */);

    if (DEBUG_DEADZONE) {
        mCurrentView.findViewById(R.id.deadzone).setBackgroundColor(0x808080FF);
    }

    if (DEBUG) {
        Slog.d(TAG, "reorient(): rot=" + mDisplay.getRotation());
    }

    setNavigationIconHints(mNavigationIconHints, true);
}

From source file:com.android.systemui.statusbar.phone.NavigationBarView.java

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    if (DEBUG)//from   www  .j  a va2  s  .  c  o  m
        Slog.d(TAG, String.format("onSizeChanged: (%dx%d) old: (%dx%d)", w, h, oldw, oldh));

    final boolean newVertical = w > 0 && h > w;
    if (newVertical != mVertical) {
        mVertical = newVertical;
        //Slog.v(TAG, String.format("onSizeChanged: h=%d, w=%d, vert=%s", h, w, mVertical?"y":"n"));
        reorient();
    }

    postCheckForInvalidLayout("sizeChanged");
    super.onSizeChanged(w, h, oldw, oldh);
}

From source file:com.android.server.MountService.java

private void copyLocaleFromMountService() {
    String systemLocale;/*from w w  w.  java  2 s .c  om*/
    try {
        systemLocale = getField(StorageManager.SYSTEM_LOCALE_KEY);
    } catch (RemoteException e) {
        return;
    }
    if (TextUtils.isEmpty(systemLocale)) {
        return;
    }

    Slog.d(TAG, "Got locale " + systemLocale + " from mount service");
    Locale locale = Locale.forLanguageTag(systemLocale);
    Configuration config = new Configuration();
    config.setLocale(locale);
    try {
        ActivityManagerNative.getDefault().updateConfiguration(config);
    } catch (RemoteException e) {
        Slog.e(TAG, "Error setting system locale from mount service", e);
    }

    // Temporary workaround for http://b/17945169.
    Slog.d(TAG, "Setting system properties to " + systemLocale + " from mount service");
    SystemProperties.set("persist.sys.language", locale.getLanguage());
    SystemProperties.set("persist.sys.country", locale.getCountry());
}

From source file:android.content.pm.PackageParser.java

private Package parseBaseApk(File apkFile, AssetManager assets, int flags) throws PackageParserException {
    final String apkPath = apkFile.getAbsolutePath();

    String volumeUuid = null;/*from  w w w. ja v a 2 s.c  om*/
    if (apkPath.startsWith(MNT_EXPAND)) {
        final int end = apkPath.indexOf('/', MNT_EXPAND.length());
        volumeUuid = apkPath.substring(MNT_EXPAND.length(), end);
    }

    mParseError = PackageManager.INSTALL_SUCCEEDED;
    mArchiveSourcePath = apkFile.getAbsolutePath();

    if (DEBUG_JAR)
        Slog.d(TAG, "Scanning base APK: " + apkPath);

    final int cookie = loadApkIntoAssetManager(assets, apkPath, flags);

    Resources res = null;
    XmlResourceParser parser = null;
    try {
        res = new Resources(assets, mMetrics, null);
        assets.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                Build.VERSION.RESOURCES_SDK_INT);
        parser = assets.openXmlResourceParser(cookie, ANDROID_MANIFEST_FILENAME);

        final String[] outError = new String[1];
        final Package pkg = parseBaseApk(res, parser, flags, outError);
        if (pkg == null) {
            throw new PackageParserException(mParseError,
                    apkPath + " (at " + parser.getPositionDescription() + "): " + outError[0]);
        }

        pkg.volumeUuid = volumeUuid;
        pkg.applicationInfo.volumeUuid = volumeUuid;
        pkg.baseCodePath = apkPath;
        pkg.mSignatures = null;

        return pkg;

    } catch (PackageParserException e) {
        throw e;
    } catch (Exception e) {
        throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION,
                "Failed to read manifest from " + apkPath, e);
    } finally {
        IoUtils.closeQuietly(parser);
    }
}

From source file:android.content.pm.PackageParser.java

private void parseSplitApk(Package pkg, int splitIndex, AssetManager assets, int flags)
        throws PackageParserException {
    final String apkPath = pkg.splitCodePaths[splitIndex];
    final File apkFile = new File(apkPath);

    mParseError = PackageManager.INSTALL_SUCCEEDED;
    mArchiveSourcePath = apkPath;//from www  .  jav a  2 s  .  c o m

    if (DEBUG_JAR)
        Slog.d(TAG, "Scanning split APK: " + apkPath);

    final int cookie = loadApkIntoAssetManager(assets, apkPath, flags);

    Resources res = null;
    XmlResourceParser parser = null;
    try {
        res = new Resources(assets, mMetrics, null);
        assets.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                Build.VERSION.RESOURCES_SDK_INT);
        parser = assets.openXmlResourceParser(cookie, ANDROID_MANIFEST_FILENAME);

        final String[] outError = new String[1];
        pkg = parseSplitApk(pkg, res, parser, flags, splitIndex, outError);
        if (pkg == null) {
            throw new PackageParserException(mParseError,
                    apkPath + " (at " + parser.getPositionDescription() + "): " + outError[0]);
        }

    } catch (PackageParserException e) {
        throw e;
    } catch (Exception e) {
        throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION,
                "Failed to read manifest from " + apkPath, e);
    } finally {
        IoUtils.closeQuietly(parser);
    }
}

From source file:com.android.server.MountService.java

private void notifyVolumeStateChange(String label, String path, int oldState, int newState) {
    final StorageVolume volume;
    final String state;
    synchronized (mVolumesLock) {
        volume = mVolumesByPath.get(path);
        state = getVolumeState(path);/*from  w  w  w . ja va 2 s.  c o  m*/
    }

    if (DEBUG_EVENTS)
        Slog.i(TAG, "notifyVolumeStateChange::" + state);

    String action = null;

    if (oldState == VolumeState.Shared && newState != oldState) {
        if (LOCAL_LOGD)
            Slog.d(TAG, "Sending ACTION_MEDIA_UNSHARED intent");
        sendStorageIntent(Intent.ACTION_MEDIA_UNSHARED, volume, UserHandle.ALL);
    }

    if (newState == VolumeState.Init) {
    } else if (newState == VolumeState.NoMedia) {
        // NoMedia is handled via Disk Remove events
    } else if (newState == VolumeState.Idle) {
        /*
         * Don't notify if we're in BAD_REMOVAL, NOFS, UNMOUNTABLE, or
         * if we're in the process of enabling UMS
         */
        if (!state.equals(Environment.MEDIA_BAD_REMOVAL) && !state.equals(Environment.MEDIA_NOFS)
                && !state.equals(Environment.MEDIA_UNMOUNTABLE) && !getUmsEnabling()) {
            if (DEBUG_EVENTS)
                Slog.i(TAG, "updating volume state for media bad removal nofs and unmountable");
            updatePublicVolumeState(volume, Environment.MEDIA_UNMOUNTED);
            action = Intent.ACTION_MEDIA_UNMOUNTED;
        }
    } else if (newState == VolumeState.Pending) {
    } else if (newState == VolumeState.Checking) {
        if (DEBUG_EVENTS)
            Slog.i(TAG, "updating volume state checking");
        updatePublicVolumeState(volume, Environment.MEDIA_CHECKING);
        action = Intent.ACTION_MEDIA_CHECKING;
    } else if (newState == VolumeState.Mounted) {
        if (DEBUG_EVENTS)
            Slog.i(TAG, "updating volume state mounted");
        updatePublicVolumeState(volume, Environment.MEDIA_MOUNTED);
        action = Intent.ACTION_MEDIA_MOUNTED;
    } else if (newState == VolumeState.Unmounting) {
        action = Intent.ACTION_MEDIA_EJECT;
    } else if (newState == VolumeState.Formatting) {
    } else if (newState == VolumeState.Shared) {
        if (DEBUG_EVENTS)
            Slog.i(TAG, "Updating volume state media mounted");
        /* Send the media unmounted event first */
        updatePublicVolumeState(volume, Environment.MEDIA_UNMOUNTED);
        sendStorageIntent(Intent.ACTION_MEDIA_UNMOUNTED, volume, UserHandle.ALL);

        if (DEBUG_EVENTS)
            Slog.i(TAG, "Updating media shared");
        updatePublicVolumeState(volume, Environment.MEDIA_SHARED);
        action = Intent.ACTION_MEDIA_SHARED;
        if (LOCAL_LOGD)
            Slog.d(TAG, "Sending ACTION_MEDIA_SHARED intent");
    } else if (newState == VolumeState.SharedMnt) {
        Slog.e(TAG, "Live shared mounts not supported yet!");
        return;
    } else {
        Slog.e(TAG, "Unhandled VolumeState {" + newState + "}");
    }

    if (action != null) {
        sendStorageIntent(action, volume, UserHandle.ALL);
    }
}