content: package androidx.work.impl.background.systemalarm;
  
  import android.content.Intent;
  import androidx.lifecycle.LifecycleService;
  import androidx.work.Logger;
  import androidx.work.impl.background.systemalarm.SystemAlarmDispatcher;
  import androidx.work.impl.utils.WakeLocks;
  import mt.Log1F380D;
  
  /* compiled from: 00C1 */
  public class SystemAlarmService extends LifecycleService implements SystemAlarmDispatcher.CommandsCompletedListener {
      private static final String TAG;
      private SystemAlarmDispatcher mDispatcher;
      private boolean mIsShutdown;
  
      static {
          String tagWithPrefix = Logger.tagWithPrefix("SystemAlarmService");
          Log1F380D.a((Object) tagWithPrefix);
          TAG = tagWithPrefix;
      }
  
      private void initializeDispatcher() {
          SystemAlarmDispatcher systemAlarmDispatcher = new SystemAlarmDispatcher(this);
          this.mDispatcher = systemAlarmDispatcher;
          systemAlarmDispatcher.setCompletedListener(this);
      }
  
      public void onAllCommandsCompleted() {
          this.mIsShutdown = true;
          Logger.get().debug(TAG, "All commands completed in dispatcher", new Throwable[0]);
          WakeLocks.checkWakeLocks();
          stopSelf();
      }
  
      public void onCreate() {
          super.onCreate();
          initializeDispatcher();
          this.mIsShutdown = false;
      }
  
      public void onDestroy() {
          super.onDestroy();
          this.mIsShutdown = true;
          this.mDispatcher.onDestroy();
      }
  
      public int onStartCommand(Intent intent, int flags, int startId) {
          super.onStartCommand(intent, flags, startId);
          if (this.mIsShutdown) {
              Logger.get().info(TAG, "Re-initializing SystemAlarmDispatcher after a request to shut-down.", new Throwable[0]);
              this.mDispatcher.onDestroy();
              initializeDispatcher();
              this.mIsShutdown = false;
          }
          if (intent == null) {
              return 3;
          }
          this.mDispatcher.add(intent, startId);
          return 3;
      }
  }
  