mirror of
https://github.com/microg/GmsCore
synced 2026-08-06 12:26:08 -04:00
parent
67cb36c589
commit
624a880f26
4 changed files with 59 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.clearcut.internal;
|
||||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
|
||||
interface IBootCountCallbacks {
|
||||
void onBootCount(in Status status, int bootCount) = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.google.android.gms.clearcut.internal;
|
||||
|
||||
import com.google.android.gms.clearcut.internal.IBootCountCallbacks;
|
||||
|
||||
interface IBootCountService {
|
||||
void getBootCount(IBootCountCallbacks callbacks) = 0;
|
||||
}
|
||||
|
|
@ -1250,6 +1250,12 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service android:name="org.microg.gms.clearcut.BootCountService" >
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.clearcut.bootcount.service.START" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="org.microg.gms.DummyService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
package org.microg.gms.clearcut
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Parcel
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import com.google.android.gms.clearcut.internal.IBootCountCallbacks
|
||||
import com.google.android.gms.clearcut.internal.IBootCountService
|
||||
import com.google.android.gms.common.api.CommonStatusCodes
|
||||
import com.google.android.gms.common.api.Status
|
||||
import com.google.android.gms.common.internal.GetServiceRequest
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks
|
||||
import org.microg.gms.BaseService
|
||||
import org.microg.gms.common.GmsService
|
||||
import org.microg.gms.utils.warnOnTransactionIssues
|
||||
|
||||
private const val TAG = "BootCountService"
|
||||
|
||||
class BootCountService : BaseService(TAG, GmsService.BOOT_COUNT) {
|
||||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
|
||||
Log.d(TAG, "handleServiceRequest")
|
||||
callback.onPostInitComplete(CommonStatusCodes.SUCCESS, BootCountServiceImpl(this), null)
|
||||
}
|
||||
}
|
||||
|
||||
class BootCountServiceImpl(private val context: Context) : IBootCountService.Stub() {
|
||||
override fun getBootCount(callbacks: IBootCountCallbacks?) {
|
||||
Log.d(TAG, "getBootCount called")
|
||||
val bootCount = Settings.Global.getInt(context.contentResolver, Settings.Global.BOOT_COUNT, 1)
|
||||
callbacks?.onBootCount(Status.SUCCESS, bootCount)
|
||||
}
|
||||
|
||||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
|
||||
warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue