package com.realsil.sdk.core.base;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.hardware.display.DisplayManager;
import android.os.IBinder;
import androidx.annotation.Keep;
import g.h.a.i;

/* JADX INFO: loaded from: classes.dex */
public abstract class BaseService extends Service {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public DisplayManager f1484f;

    @Keep
    public Context mContext;

    @Keep
    public int notificationId = 1230;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final DisplayManager.DisplayListener f1485m = new a();

    public class a implements DisplayManager.DisplayListener {
        @Override // android.hardware.display.DisplayManager.DisplayListener
        public void onDisplayAdded(int i2) {
        }

        @Override // android.hardware.display.DisplayManager.DisplayListener
        public void onDisplayChanged(int i2) {
        }

        @Override // android.hardware.display.DisplayManager.DisplayListener
        public void onDisplayRemoved(int i2) {
        }
    }

    @Override // android.app.Service
    public IBinder onBind(Intent intent) {
        i.U3("in onBind()");
        return null;
    }

    @Override // android.app.Service
    public void onCreate() {
        super.onCreate();
        this.mContext = this;
        DisplayManager displayManager = (DisplayManager) getSystemService("display");
        this.f1484f = displayManager;
        if (displayManager != null) {
            displayManager.registerDisplayListener(this.f1485m, null);
        }
        NotificationChannel notificationChannel = new NotificationChannel("rtk_channel_id", "rtk_channel_name", 0);
        notificationChannel.setLightColor(-16776961);
        notificationChannel.setLockscreenVisibility(0);
        NotificationManager notificationManager = (NotificationManager) getSystemService("notification");
        if (notificationManager != null) {
            notificationManager.createNotificationChannel(notificationChannel);
        }
    }

    @Override // android.app.Service
    public void onDestroy() {
        super.onDestroy();
        DisplayManager displayManager = this.f1484f;
        if (displayManager != null) {
            displayManager.unregisterDisplayListener(this.f1485m);
        }
        stopForeground(true);
    }

    @Override // android.app.Service
    public void onRebind(Intent intent) {
        i.U3("in onRebind()");
        super.onRebind(intent);
    }

    @Override // android.app.Service
    public int onStartCommand(Intent intent, int i2, int i3) {
        return 1;
    }

    @Override // android.app.Service
    public boolean onUnbind(Intent intent) {
        i.w0("Last client unbound from service");
        return true;
    }
}
