예제 #1
0
  public void updateResources() {
    // Update the search icon with drawable from the search .apk
    if (!mSearchDisabled) {
      Intent intent =
          ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
              .getAssistIntent(mContext, UserHandle.USER_CURRENT);
      if (intent != null) {
        // XXX Hack. We need to substitute the icon here but haven't formalized
        // the public API. The "_google" metadata will be going away, so
        // DON'T USE IT!
        ComponentName component = intent.getComponent();
        boolean replaced =
            mGlowPadView.replaceTargetDrawablesIfPresent(
                component,
                ASSIST_ICON_METADATA_NAME + "_google",
                com.android.internal.R.drawable.ic_action_assist_generic);

        if (!replaced
            && !mGlowPadView.replaceTargetDrawablesIfPresent(
                component,
                ASSIST_ICON_METADATA_NAME,
                com.android.internal.R.drawable.ic_action_assist_generic)) {
          Slog.w(TAG, "Couldn't grab icon from package " + component);
        }
      }
    }

    mGlowPadView.setEnableTarget(
        com.android.internal.R.drawable.ic_lockscreen_camera, !mCameraDisabled);
    mGlowPadView.setEnableTarget(
        com.android.internal.R.drawable.ic_action_assist_generic, !mSearchDisabled);
  }
 private void maybeSwapSearchIcon() {
   Intent intent = SearchManager.getAssistIntent(mContext);
   if (intent != null) {
     ComponentName component = intent.getComponent();
     if (component == null
         || !mGlowPadView.replaceTargetDrawablesIfPresent(
             component,
             ASSIST_ICON_METADATA_NAME,
             com.android.internal.R.drawable.ic_action_assist_generic)) {
       if (DEBUG) Slog.v(TAG, "Couldn't grab icon for component " + component);
     }
   }
 }