Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,54 @@
/**
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.wearable.consent

import android.content.SharedPreferences
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.gms.wearable.R

class TermsOfServiceActivity : AppCompatActivity() {

companion object {
const val WEARABLE_TOS_ACCEPTED = "wearable_tos_accepted"
const val WEARABLE_TOS_PREFS = "wearable_tos_prefs"
}

private var resultCode: Int = RESULT_CANCELED

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setResult(RESULT_CANCELED)
finish()
setContentView(R.layout.activity_wearable_tos)

findViewById<android.widget.Button>(R.id.button_accept).setOnClickListener {
resultCode = RESULT_OK
saveTosAccepted(true)
finish()
}

findViewById<android.widget.Button>(R.id.button_decline).setOnClickListener {
resultCode = RESULT_CANCELED
finish()
}
}

override fun finish() {
setResult(resultCode)
super.finish()
}

private fun saveTosAccepted(accepted: Boolean) {
getSharedPreferences(WEARABLE_TOS_PREFS, MODE_PRIVATE)
.edit()
.putBoolean(WEARABLE_TOS_ACCEPTED, accepted)
.apply()
}

fun isTosAccepted(): Boolean {
return getSharedPreferences(WEARABLE_TOS_PREFS, MODE_PRIVATE)
.getBoolean(WEARABLE_TOS_ACCEPTED, false)
}
}
66 changes: 66 additions & 0 deletions play-services-core/src/main/res/layout/activity_wearable_tos.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2025 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="24dp">

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/wearable_tos_title"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="?attr/colorPrimary"
android:gravity="center"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/wearable_tos_message"
android:textSize="14sp"
android:gravity="center"
android:layout_marginBottom="24dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">

<Button
android:id="@+id/button_decline"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/decline" />

<Button
android:id="@+id/button_accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/accept" />
</LinearLayout>

</LinearLayout>
6 changes: 6 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,10 @@ Please set up a password, PIN, or pattern lock screen."</string>
<string name="location_sharing_turn_off_confirm">Turn off</string>
<string name="location_sharing_confirm_dialog_title">Enable Location Sharing</string>
<string name="location_sharing_confirm_dialog_text">People you share your location with can always see:\n·Your name and photo\n·Your device\'s recent location,even when you\'re not using a Google service\n·Your device\'s battery power,and if it\'s charging\n·Your arrival and departure time,if they add a Location Sharing notification</string>

<!-- WearOS Terms of Service -->
<string name="wearable_tos_title">WearOS Terms of Service</string>
<string name="wearable_tos_message">By connecting to a WearOS device, you agree to allow Google services to exchange data with your wearable device, including but not limited to notifications, phone status, and app data synchronization.\n\nYour data will be processed in accordance with Google\'s Privacy Policy.</string>
<string name="accept">Accept</string>
<string name="decline">Decline</string>
</resources>