-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fitness: Add FITNESS_CONFIG & FITNESS_SESSIONS dummy (#2600)
Co-authored-by: Marvin W <[email protected]>
- Loading branch information
1 parent
b9b7278
commit f0698a1
Showing
54 changed files
with
3,231 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
dependencies { | ||
api project(':play-services-fitness') | ||
|
||
implementation project(':play-services-base-core') | ||
} | ||
|
||
android { | ||
namespace "org.microg.gms.fitness.core" | ||
|
||
compileSdkVersion androidCompileSdk | ||
buildToolsVersion "$androidBuildVersionTools" | ||
|
||
defaultConfig { | ||
versionName version | ||
minSdkVersion androidMinSdk | ||
targetSdkVersion androidTargetSdk | ||
} | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
lintOptions { | ||
disable 'MissingTranslation', 'GetLocales' | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = 1.8 | ||
} | ||
} | ||
|
||
// Not publishable yet | ||
// apply from: '../../gradle/publish-android.gradle' | ||
|
||
description = 'microG service implementation for play-services-fitness' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ SPDX-FileCopyrightText: 2024 microG Project Team | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application> | ||
<service | ||
android:name="com.google.android.gms.fitness.service.config.FitConfigBroker" | ||
android:exported="true" | ||
android:enabled="true"> | ||
<intent-filter> | ||
<action android:name="com.google.android.gms.fitness.ConfigApi" /> | ||
</intent-filter> | ||
</service> | ||
|
||
<service | ||
android:name="com.google.android.gms.fitness.service.history.FitHistoryBroker" | ||
android:enabled="true" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="com.google.android.gms.fitness.HistoryApi" /> | ||
</intent-filter> | ||
</service> | ||
|
||
<service | ||
android:name="com.google.android.gms.fitness.service.sessions.FitSessionsBroker" | ||
android:enabled="true" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="com.google.android.gms.fitness.SessionsApi" /> | ||
</intent-filter> | ||
</service> | ||
</application> | ||
</manifest> |
51 changes: 51 additions & 0 deletions
51
...ess/core/src/main/kotlin/com/google/android/gms/fitness/service/config/FitConfigBroker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.google.android.gms.fitness.service.config | ||
|
||
import android.os.Parcel | ||
import android.util.Log | ||
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 com.google.android.gms.fitness.internal.IGoogleFitConfigApi | ||
import com.google.android.gms.fitness.request.DataTypeCreateRequest | ||
import com.google.android.gms.fitness.request.DisableFitRequest | ||
import com.google.android.gms.fitness.request.ReadDataTypeRequest | ||
import org.microg.gms.BaseService | ||
import org.microg.gms.common.GmsService | ||
import org.microg.gms.utils.warnOnTransactionIssues | ||
|
||
private const val TAG = "FitConfigBroker" | ||
|
||
class FitConfigBroker : BaseService(TAG, GmsService.FITNESS_CONFIG) { | ||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { | ||
callback.onPostInitComplete(CommonStatusCodes.SUCCESS, FitConfigBrokerImpl(), null) | ||
} | ||
} | ||
|
||
class FitConfigBrokerImpl : IGoogleFitConfigApi.Stub() { | ||
|
||
override fun createCustomDataType(request: DataTypeCreateRequest?) { | ||
Log.d(TAG, "Not implemented createCustomDataType: $request") | ||
} | ||
|
||
override fun readDataType(request: ReadDataTypeRequest?) { | ||
Log.d(TAG, "Not implemented readDataType: $request") | ||
} | ||
|
||
override fun disableFit(request: DisableFitRequest?) { | ||
Log.d(TAG, "Method <disableFit> Called: $request") | ||
try { | ||
request?.callback?.onResult(Status.SUCCESS) | ||
} catch (e: Exception) { | ||
Log.w(TAG, "disableFit Error $e") | ||
} | ||
} | ||
|
||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = | ||
warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...core/src/main/kotlin/com/google/android/gms/fitness/service/sessions/FitSessionsBroker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.google.android.gms.fitness.service.sessions; | ||
|
||
import android.os.Parcel | ||
import android.util.Log | ||
import com.google.android.gms.common.api.CommonStatusCodes | ||
import com.google.android.gms.common.internal.GetServiceRequest | ||
import com.google.android.gms.common.internal.IGmsCallbacks | ||
import com.google.android.gms.fitness.internal.IGoogleFitSessionsApi | ||
import com.google.android.gms.fitness.request.SessionInsertRequest | ||
import com.google.android.gms.fitness.request.SessionReadRequest | ||
import com.google.android.gms.fitness.request.SessionRegistrationRequest | ||
import com.google.android.gms.fitness.request.SessionStartRequest | ||
import com.google.android.gms.fitness.request.SessionStopRequest | ||
import com.google.android.gms.fitness.request.SessionUnregistrationRequest | ||
import org.microg.gms.BaseService | ||
import org.microg.gms.common.GmsService | ||
import org.microg.gms.utils.warnOnTransactionIssues | ||
|
||
private const val TAG = "FitSessionsBroker" | ||
|
||
class FitSessionsBroker : BaseService(TAG, GmsService.FITNESS_SESSIONS) { | ||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { | ||
callback.onPostInitComplete(CommonStatusCodes.SUCCESS, FitSessionsBrokerImpl(), null) | ||
} | ||
} | ||
|
||
class FitSessionsBrokerImpl : IGoogleFitSessionsApi.Stub() { | ||
override fun startRequest(startRequest: SessionStartRequest?) { | ||
Log.d(TAG, "Not implemented startRequest: $startRequest") | ||
} | ||
|
||
override fun stopRequest(stopRequest: SessionStopRequest?) { | ||
Log.d(TAG, "Not implemented stopRequest: $stopRequest") | ||
} | ||
|
||
override fun insertRequest(insetRequest: SessionInsertRequest?) { | ||
Log.d(TAG, "Not implemented insertRequest: $insetRequest") | ||
} | ||
|
||
override fun readRequest(readRequest: SessionReadRequest?) { | ||
Log.d(TAG, "Not implemented readRequest: $readRequest") | ||
} | ||
|
||
override fun registrationRequest(registrationRequest: SessionRegistrationRequest?) { | ||
Log.d(TAG, "Not implemented registrationRequest: $registrationRequest") | ||
} | ||
|
||
override fun unRegistrationRequest(unRegistrationRequest: SessionUnregistrationRequest?) { | ||
Log.d(TAG, "Not implemented unRegistrationRequest: $unRegistrationRequest") | ||
} | ||
|
||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = | ||
warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } | ||
} |
12 changes: 12 additions & 0 deletions
12
...ices-fitness/src/main/aidl/com/google/android/gms/fitness/internal/IDataTypeCallback.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.google.android.gms.fitness.internal; | ||
|
||
import com.google.android.gms.fitness.result.DataTypeResult; | ||
|
||
interface IDataTypeCallback { | ||
void onDataType(in DataTypeResult dataTypeResult) = 0; | ||
} |
16 changes: 16 additions & 0 deletions
16
...es-fitness/src/main/aidl/com/google/android/gms/fitness/internal/IGoogleFitConfigApi.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.google.android.gms.fitness.internal; | ||
|
||
import com.google.android.gms.fitness.request.DataTypeCreateRequest; | ||
import com.google.android.gms.fitness.request.DisableFitRequest; | ||
import com.google.android.gms.fitness.request.ReadDataTypeRequest; | ||
|
||
interface IGoogleFitConfigApi { | ||
void createCustomDataType(in DataTypeCreateRequest request) = 0; | ||
void readDataType(in ReadDataTypeRequest request) = 1; | ||
void disableFit(in DisableFitRequest request) = 21; | ||
} |
21 changes: 21 additions & 0 deletions
21
...-fitness/src/main/aidl/com/google/android/gms/fitness/internal/IGoogleFitSessionsApi.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package com.google.android.gms.fitness.internal; | ||
|
||
import com.google.android.gms.fitness.request.SessionStartRequest; | ||
import com.google.android.gms.fitness.request.SessionStopRequest; | ||
import com.google.android.gms.fitness.request.SessionInsertRequest; | ||
import com.google.android.gms.fitness.request.SessionReadRequest; | ||
import com.google.android.gms.fitness.request.SessionRegistrationRequest; | ||
import com.google.android.gms.fitness.request.SessionUnregistrationRequest; | ||
|
||
interface IGoogleFitSessionsApi { | ||
void startRequest(in SessionStartRequest startRequest) = 0; | ||
void stopRequest(in SessionStopRequest stopRequest) = 1; | ||
void insertRequest(in SessionInsertRequest insetRequest) = 2; | ||
void readRequest(in SessionReadRequest readRequest) = 3; | ||
void registrationRequest(in SessionRegistrationRequest registrationRequest) = 4; | ||
void unRegistrationRequest(in SessionUnregistrationRequest unRegistrationRequest) = 5; | ||
} |
11 changes: 11 additions & 0 deletions
11
...s-fitness/src/main/aidl/com/google/android/gms/fitness/internal/ISessionReadCallback.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package com.google.android.gms.fitness.internal; | ||
|
||
import com.google.android.gms.fitness.result.SessionReadResult; | ||
|
||
interface ISessionReadCallback { | ||
void onResult(in SessionReadResult sessionReadResult) = 0; | ||
} |
11 changes: 11 additions & 0 deletions
11
...s-fitness/src/main/aidl/com/google/android/gms/fitness/internal/ISessionStopCallback.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package com.google.android.gms.fitness.internal; | ||
|
||
import com.google.android.gms.fitness.result.SessionStopResult; | ||
|
||
interface ISessionStopCallback { | ||
void onResult(in SessionStopResult sessionStopReult) = 0; | ||
} |
Oops, something went wrong.