AppIndexingJobService.java 2.14 KB
package com.bitstrips.imoji.firebase;

import android.annotation.TargetApi;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Message;
import android.os.Messenger;
import android.util.Log;
import com.bitstrips.imoji.ImojiApplication;
import com.bitstrips.imoji.manager.AppIndexingManager;
import java.text.MessageFormat;
import javax.inject.Inject;

@TargetApi(21)
public class AppIndexingJobService
  extends JobService
  implements Handler.Callback
{
  public static final int INDEXING_FAILED = 0;
  public static final int INDEXING_MESSAGE_TYPE = 100;
  public static final int INDEXING_SUCCEEDED = 1;
  private static final String LOG_TAG_APP_INDEXING = "AppIndexing";
  @Inject
  AppIndexingManager mAppIndexingManager;
  private Handler mHandler = new Handler(this);
  
  public boolean handleMessage(Message paramMessage)
  {
    int i = paramMessage.what;
    if (i == 100)
    {
      if (paramMessage.arg1 != 1) {}
      for (boolean bool = true;; bool = false)
      {
        paramMessage = (JobParameters)paramMessage.obj;
        MessageFormat.format("Finishing scheduled app indexing job ID: {0}; needs reschedule: {1}", new Object[] { Integer.valueOf(paramMessage.getJobId()), Boolean.valueOf(bool) });
        jobFinished(paramMessage, bool);
        return true;
      }
    }
    Log.e("AppIndexing", "Unsupported message type: " + i);
    return true;
  }
  
  public void onCreate()
  {
    super.onCreate();
    ((ImojiApplication)getApplication()).inject(this);
  }
  
  public boolean onStartJob(JobParameters paramJobParameters)
  {
    this.mAppIndexingManager.updateIndex(new AppIndexingParams.Builder().setForceRequestAvatarInfo(true).setIndexingReason("scheduled").setMessenger(new Messenger(this.mHandler)).setJobParams(paramJobParameters).build());
    return true;
  }
  
  public boolean onStopJob(JobParameters paramJobParameters)
  {
    return true;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/firebase/AppIndexingJobService.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */