universal7885: CameraLightSensor: Allow user to mute the app's notification

android.app.NotificationChannel
public void setBlockable(boolean blockable)
Allows users to block notifications sent through this channel, if this channel belongs to a package that is signed with the system signature. If the channel does not belong to a package that is signed with the system signature, this method does nothing, since such channels are blockable by default and cannot be set to be unblockable.

Change-Id: Idfa7a672c0be585381239b879ce386e6e99d0619
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2021-11-16 14:56:58 +09:00
commit 0522bd9d3d
No known key found for this signature in database
GPG key ID: 9675C32163D88D30

View file

@ -53,6 +53,7 @@ open class CameraLightSensorService : Service() {
mContext!!.basePackageName, "CameraLightSensor",
NotificationManager.IMPORTANCE_LOW
)
channel.isBlockable = true
nm.createNotificationChannel(channel)
val builder = NotificationCompat.Builder(mContext!!, mContext!!.basePackageName)
val notificationIntent = Intent(mContext, CameraLightSensorService::class.java)
@ -61,7 +62,6 @@ open class CameraLightSensorService : Service() {
notificationIntent, PendingIntent.FLAG_IMMUTABLE
)
//set
builder.setContentIntent(contentIntent)
builder.setSmallIcon(R.drawable.ic_brightness)
builder.setContentTitle("Camera Light Sensor Service")
@ -429,4 +429,4 @@ open class CameraLightSensorService : Service() {
}
}
}
}
}