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
App Lounge
Commits
41bc5547
Commit
41bc5547
authored
Aug 30, 2021
by
Aayush Gupta
Browse files
Merge branch 'issue-3328JSON' into 'master'
update systemApp.json for microG package See merge request e/apps/apps!76
parents
e3fed212
14440346
Pipeline
#132664
passed with stages
in 7 minutes and 58 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/assets/systemApp.json
View file @
41bc5547
{
"com.explusalpha.Snes9xPlus"
:{
"url"
:
"https://cleanapk.org/#/app/5b15b33a89bb693d3a3e806b"
,
"project_id"
:
"1001"
,
"app_name"
:
"Snes9x EX+"
"com.google.android.gms"
:
{
"url"
:
"https://gitlab.e.foundation/e/apps/GmsCore"
,
"project_id"
:
"149"
,
"app_name"
:
"microG Exposure Notification version"
},
"foundation.e.mail"
:
{
"url"
:
"https://gitlab.e.foundation/e/apps/Mail"
,
"project_id"
:
"13"
,
"app_name"
:
"Mail"
}
}
\ No newline at end of file
app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt
View file @
41bc5547
...
...
@@ -53,15 +53,18 @@ class IntegrityVerificationTask(
private
val
fullData
:
FullData
,
private
val
integrityVerificationCallback
:
IntegrityVerificationCallback
)
:
AsyncTask
<
Context
,
Void
,
Context
>()
{
private
lateinit
var
systemJsonData
:
JSONObject
private
var
verificationSuccessful
:
Boolean
=
false
private
var
TAG
=
"IntegrityVerificationTask"
override
fun
doInBackground
(
vararg
context
:
Context
):
Context
{
try
{
verificationSuccessful
=
if
(
isSystemApplication
(
fullData
.
packageName
))
{
verifySystemSignature
(
context
[
0
])
}
else
if
(
isfDroidApplication
(
fullData
.
packageName
))
{
val
packageName
=
getAPK_PackageName
(
context
[
0
])
verificationSuccessful
=
if
(
isSystemApplication
(
packageName
.
toString
()))
{
verifyAPKSignature
(
context
[
0
])
}
else
if
(
isfDroidApplication
(
packageName
.
toString
()))
{
verifyFdroidSignature
(
context
[
0
])
}
else
{
checkGoogleApp
(
context
[
0
])
...
...
@@ -84,14 +87,44 @@ class IntegrityVerificationTask(
return
false
}
private
fun
verifySystemSignature
(
context
:
Context
):
Boolean
{
if
(!
fullData
.
getLastVersion
()
?.
signature
.
isNullOrEmpty
())
{
return
fullData
.
getLastVersion
()
?.
signature
==
private
fun
verifyAPKSignature
(
context
:
Context
):
Boolean
{
if
(
getAPKSignature
(
context
)
!=
null
)
{
return
getAPKSignature
(
context
)
?.
toCharsString
()
==
getSystemSignature
(
context
.
packageManager
)
?.
toCharsString
()
}
return
false
}
private
fun
getAPKSignature
(
context
:
Context
):
Signature
?
{
try
{
val
fullPath
:
String
=
applicationInfo
.
getApkFile
(
context
,
fullData
.
basicData
).
absolutePath
val
releaseSig
=
context
.
packageManager
.
getPackageArchiveInfo
(
fullPath
,
PackageManager
.
GET_SIGNATURES
)
return
getFirstSignature
(
releaseSig
)
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
Log
.
d
(
TAG
,
"Unable to find the package: android"
)
}
return
null
}
private
fun
getAPK_PackageName
(
context
:
Context
):
String
?
{
val
pm
:
PackageManager
=
context
.
packageManager
val
fullPath
:
String
=
applicationInfo
.
getApkFile
(
context
,
fullData
.
basicData
).
absolutePath
val
info
=
pm
.
getPackageArchiveInfo
(
fullPath
,
0
)
if
(
info
!=
null
)
{
return
info
.
packageName
}
else
return
null
}
private
fun
getFirstSignature
(
pkg
:
PackageInfo
?):
Signature
?
{
return
if
(
pkg
?.
signatures
!=
null
&&
pkg
.
signatures
.
isNotEmpty
())
{
pkg
.
signatures
[
0
]
...
...
@@ -159,7 +192,8 @@ class IntegrityVerificationTask(
}
}
try
{
if
(
packageName
==
JSONObject
(
jsonResponse
).
get
(
packageName
))
{
if
(
JSONObject
(
jsonResponse
).
has
(
packageName
))
{
systemJsonData
=
JSONObject
(
jsonResponse
).
getJSONObject
(
packageName
)
return
true
}
}
catch
(
e
:
Exception
)
{
...
...
app/src/main/java/foundation/e/apps/utils/Constants.kt
View file @
41bc5547
...
...
@@ -71,5 +71,5 @@ object Constants {
// Integrity Verification
const
val
F_DROID_PACKAGES_URL
=
"https://f-droid.org/en/packages/"
const
val
SYSTEM_PACKAGES_JSON_FILE_URL
=
"https://gitlab.e.foundation/e/apps/apps/-/raw/
e169c1905114d97af867b051f96c38166f4782e2
/app/src/main/assets/systemApp.json"
const
val
SYSTEM_PACKAGES_JSON_FILE_URL
=
"https://gitlab.e.foundation/e/apps/apps/-/raw/
master
/app/src/main/assets/systemApp.json"
}
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