Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
GmsCore
Commits
f0337b5d
Verified
Commit
f0337b5d
authored
Dec 20, 2020
by
Marvin W.
🐿
Browse files
Move EN and GCM service in persistent subprocess
This increases stability/durability of these services in case of crashes
parent
6d423bb8
Changes
7
Hide whitespace changes
Inline
Side-by-side
play-services-base-core/src/main/java/org/microg/gms/common/PackageUtils.java
View file @
f0337b5d
...
...
@@ -24,6 +24,7 @@ import android.content.pm.PackageInfo;
import
android.content.pm.PackageManager
;
import
android.content.pm.Signature
;
import
android.os.Binder
;
import
android.util.Log
;
import
androidx.annotation.Nullable
;
...
...
@@ -245,6 +246,36 @@ public class PackageUtils {
}
}
public
static
boolean
isPersistentProcess
()
{
String
processName
=
getProcessName
();
if
(
processName
==
null
)
{
Log
.
w
(
"GmsPackageUtils"
,
"Can't determine process name of current process"
);
return
false
;
}
return
processName
.
endsWith
(
":persistent"
);
}
public
static
boolean
isMainProcess
(
Context
context
)
{
String
processName
=
getProcessName
();
if
(
processName
==
null
)
{
Log
.
w
(
"GmsPackageUtils"
,
"Can't determine process name of current process"
);
return
false
;
}
return
processName
.
equals
(
context
.
getPackageName
());
}
public
static
void
warnIfNotPersistentProcess
(
Class
<?>
clazz
)
{
if
(!
isPersistentProcess
())
{
Log
.
w
(
"GmsPackageUtils"
,
clazz
.
getSimpleName
()
+
" initialized outside persistent process"
,
new
RuntimeException
());
}
}
public
static
void
warnIfNotMainProcess
(
Context
context
,
Class
<?>
clazz
)
{
if
(!
isMainProcess
(
context
))
{
Log
.
w
(
"GmsPackageUtils"
,
clazz
.
getSimpleName
()
+
" initialized outside main process"
,
new
RuntimeException
());
}
}
public
static
String
sha1sum
(
byte
[]
bytes
)
{
MessageDigest
md
;
try
{
...
...
play-services-core/src/main/AndroidManifest.xml
View file @
f0337b5d
...
...
@@ -108,10 +108,10 @@
tools:ignore=
"ProtectedPermissions"
/>
<application
android:forceQueryable=
"true"
android:name=
"androidx.multidex.MultiDexApplication"
android:allowBackup=
"false"
android:extractNativeLibs=
"false"
android:forceQueryable=
"true"
android:icon=
"@mipmap/ic_core_service_app"
android:label=
"@string/gms_app_name"
android:theme=
"@style/Theme.AppCompat.DayNight"
>
...
...
@@ -128,12 +128,15 @@
<!-- Location -->
<activity
android:name=
"org.microg.nlp.ui.BackendSettingsActivity"
android:process=
":ui"
/>
<activity
android:name=
"org.microg.nlp.ui.BackendSettingsActivity"
android:process=
":ui"
/>
<activity
android:name=
"org.microg.gms.ui.PlacePickerActivity"
android:exported=
"true"
android:process=
":ui"
android:exported=
"true"
android:label=
"@string/pick_place_title"
android:process=
":ui"
android:theme=
"@style/Theme.AppCompat.DayNight.NoActionBar"
>
<intent-filter>
<action
android:name=
"com.google.android.gms.location.places.ui.PICK_PLACE"
/>
...
...
@@ -220,7 +223,8 @@
<!-- Cloud Messaging -->
<service
android:name=
"org.microg.gms.gcm.PushRegisterService"
>
android:name=
"org.microg.gms.gcm.PushRegisterService"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"com.google.android.c2dm.intent.REGISTER"
/>
<action
android:name=
"com.google.android.c2dm.intent.UNREGISTER"
/>
...
...
@@ -229,24 +233,33 @@
</intent-filter>
</service>
<receiver
android:name=
"org.microg.gms.gcm.PushRegisterReceiver"
>
<receiver
android:name=
"org.microg.gms.gcm.PushRegisterReceiver"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"com.google.iid.TOKEN_REQUEST"
/>
</intent-filter>
</receiver>
<service
android:name=
"org.microg.gms.gcm.McsService"
/>
<service
android:name=
"org.microg.gms.gcm.McsService"
android:process=
":persistent"
/>
<receiver
android:name=
"org.microg.gms.gcm.SendReceiver"
>
android:name=
"org.microg.gms.gcm.SendReceiver"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"com.google.android.gcm.intent.SEND"
/>
</intent-filter>
</receiver>
<receiver
android:name=
"org.microg.gms.gcm.ServiceInfoReceiver"
/>
<receiver
android:name=
"org.microg.gms.gcm.ServiceInfoReceiver"
android:process=
":persistent"
/>
<receiver
android:name=
"org.microg.gms.gcm.TriggerReceiver"
>
<receiver
android:name=
"org.microg.gms.gcm.TriggerReceiver"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<action
android:name=
"android.intent.action.AIRPLANE_MODE"
/>
...
...
@@ -267,7 +280,9 @@
</intent-filter>
</receiver>
<receiver
android:name=
"org.microg.gms.gcm.UnregisterReceiver"
>
<receiver
android:name=
"org.microg.gms.gcm.UnregisterReceiver"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"android.intent.action.PACKAGE_DATA_CLEARED"
/>
<action
android:name=
"android.intent.action.PACKAGE_FULLY_REMOVED"
/>
...
...
play-services-core/src/main/java/org/microg/gms/checkin/CheckinPrefs.java
View file @
f0337b5d
...
...
@@ -21,9 +21,7 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
public
static
CheckinPrefs
get
(
Context
context
)
{
if
(
INSTANCE
==
null
)
{
if
(!
context
.
getPackageName
().
equals
(
PackageUtils
.
getProcessName
()))
{
Log
.
w
(
"Preferences"
,
CheckinPrefs
.
class
.
getName
()
+
" initialized outside main process"
,
new
RuntimeException
());
}
PackageUtils
.
warnIfNotMainProcess
(
context
,
CheckinPrefs
.
class
);
if
(
context
==
null
)
return
new
CheckinPrefs
(
null
);
INSTANCE
=
new
CheckinPrefs
(
context
.
getApplicationContext
());
}
...
...
play-services-core/src/main/java/org/microg/gms/gcm/GcmPrefs.java
View file @
f0337b5d
...
...
@@ -53,9 +53,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
public
static
GcmPrefs
get
(
Context
context
)
{
if
(
INSTANCE
==
null
)
{
if
(!
context
.
getPackageName
().
equals
(
PackageUtils
.
getProcessName
()))
{
Log
.
w
(
"Preferences"
,
GcmPrefs
.
class
.
getName
()
+
" initialized outside main process"
,
new
RuntimeException
());
}
PackageUtils
.
warnIfNotPersistentProcess
(
GcmPrefs
.
class
);
if
(
context
==
null
)
return
new
GcmPrefs
(
null
);
INSTANCE
=
new
GcmPrefs
(
context
.
getApplicationContext
());
}
...
...
play-services-core/src/main/java/org/microg/gms/snet/SafetyNetPrefs.java
View file @
f0337b5d
...
...
@@ -38,9 +38,7 @@ public class SafetyNetPrefs implements SharedPreferences.OnSharedPreferenceChang
public
static
SafetyNetPrefs
get
(
Context
context
)
{
if
(
INSTANCE
==
null
)
{
if
(!
context
.
getPackageName
().
equals
(
PackageUtils
.
getProcessName
()))
{
Log
.
w
(
"Preferences"
,
SafetyNetPrefs
.
class
.
getName
()
+
" initialized outside main process"
,
new
RuntimeException
());
}
PackageUtils
.
warnIfNotMainProcess
(
context
,
SafetyNetPrefs
.
class
);
if
(
context
==
null
)
return
new
SafetyNetPrefs
(
null
);
INSTANCE
=
new
SafetyNetPrefs
(
context
.
getApplicationContext
());
}
...
...
play-services-nearby-core/src/main/AndroidManifest.xml
View file @
f0337b5d
...
...
@@ -21,20 +21,34 @@
<!-- Exposure Notifications -->
<service
android:name=
"org.microg.gms.nearby.exposurenotification.ScannerService"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.AdvertiserService"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.CleanupService"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.NotifyService"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.ScannerService"
android:process=
":persistent"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.AdvertiserService"
android:process=
":persistent"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.CleanupService"
android:process=
":persistent"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.NotifyService"
android:process=
":persistent"
/>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.ExposureNotificationService"
>
<service
android:name=
"org.microg.gms.nearby.exposurenotification.ExposureNotificationService"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"com.google.android.gms.nearby.exposurenotification.START"
/>
</intent-filter>
</service>
<receiver
android:name=
"org.microg.gms.nearby.exposurenotification.ServiceInfoReceiver"
/>
<receiver
android:name=
"org.microg.gms.nearby.exposurenotification.ServiceInfoReceiver"
android:process=
":persistent"
/>
<receiver
android:name=
"org.microg.gms.nearby.exposurenotification.ServiceTrigger"
>
<receiver
android:name=
"org.microg.gms.nearby.exposurenotification.ServiceTrigger"
android:process=
":persistent"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
...
...
@@ -46,8 +60,8 @@
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.microg.exposure.export"
android:
grantUriPermissions=
"tru
e"
android:
exported=
"fals
e"
>
android:
exported=
"fals
e"
android:
grantUriPermissions=
"tru
e"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/preferences_exposure_notifications_exportedfiles"
/>
...
...
play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposurePreferences.kt
View file @
f0337b5d
...
...
@@ -8,18 +8,14 @@ package org.microg.gms.nearby.exposurenotification
import
android.content.Context
import
android.content.Intent
import
android.content.SharedPreferences
import
android.util.Log
import
androidx.preference.PreferenceManager
import
org.microg.gms.common.PackageUtils
class
ExposurePreferences
(
private
val
context
:
Context
)
{
private
var
preferences
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
)
init
{
if
(
context
.
packageName
!=
PackageUtils
.
getProcessName
())
{
Log
.
w
(
"Preferences"
,
ExposurePreferences
::
class
.
simpleName
+
" initialized outside main process"
,
RuntimeException
())
}
PackageUtils
.
warnIfNotPersistentProcess
(
ExposurePreferences
::
class
.
java
)
}
var
enabled
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment