Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
bcdface6
Commit
bcdface6
authored
Jul 14, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crashing when installing modules
parent
4dc9419d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
17 deletions
+14
-17
build.gradle
app/build.gradle
+2
-2
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+2
-1
ReposAdapter.java
...main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
+4
-6
DownloadReceiver.java
...java/com/topjohnwu/magisk/receivers/DownloadReceiver.java
+2
-4
ManagerUpdate.java
...in/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java
+4
-4
No files found.
app/build.gradle
View file @
bcdface6
...
@@ -8,8 +8,8 @@ android {
...
@@ -8,8 +8,8 @@ android {
applicationId
"com.topjohnwu.magisk"
applicationId
"com.topjohnwu.magisk"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
26
targetSdkVersion
26
versionCode
4
5
versionCode
4
6
versionName
"5.0.
5
"
versionName
"5.0.
6
"
ndk
{
ndk
{
moduleName
'zipadjust'
moduleName
'zipadjust'
abiFilters
'x86'
,
'armeabi-v7a'
abiFilters
'x86'
,
'armeabi-v7a'
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
bcdface6
...
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk;
...
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk;
import
android.animation.Animator
;
import
android.animation.Animator
;
import
android.animation.ValueAnimator
;
import
android.animation.ValueAnimator
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -142,7 +143,7 @@ public class MagiskFragment extends Fragment
...
@@ -142,7 +143,7 @@ public class MagiskFragment extends Fragment
private
boolean
verity
=
keepVerityChkbox
.
isChecked
();
private
boolean
verity
=
keepVerityChkbox
.
isChecked
();
@Override
@Override
public
void
onDownloadDone
(
Uri
uri
)
{
public
void
onDownloadDone
(
Uri
uri
,
Context
context
)
{
new
ProcessMagiskZip
(
getActivity
(),
uri
,
boot
,
enc
,
verity
).
exec
();
new
ProcessMagiskZip
(
getActivity
(),
uri
,
boot
,
enc
,
verity
).
exec
();
}
}
},
},
...
...
app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
View file @
bcdface6
...
@@ -65,9 +65,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
...
@@ -65,9 +65,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mContext
,
mContext
,
new
DownloadReceiver
()
{
new
DownloadReceiver
()
{
@Override
@Override
public
void
onDownloadDone
(
Uri
uri
)
{
public
void
onDownloadDone
(
Uri
uri
,
Context
context
)
{
Activity
activity
=
(
Activity
)
mContext
;
new
ProcessRepoZip
((
Activity
)
mContext
,
uri
,
true
).
exec
();
new
ProcessRepoZip
(
activity
,
uri
,
true
).
exec
();
}
}
},
},
repo
.
getZipUrl
(),
repo
.
getZipUrl
(),
...
@@ -76,9 +75,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
...
@@ -76,9 +75,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
mContext
,
mContext
,
new
DownloadReceiver
()
{
new
DownloadReceiver
()
{
@Override
@Override
public
void
onDownloadDone
(
Uri
uri
)
{
public
void
onDownloadDone
(
Uri
uri
,
Context
context
)
{
Activity
activity
=
(
Activity
)
mContext
;
new
ProcessRepoZip
((
Activity
)
mContext
,
uri
,
false
).
exec
();
new
ProcessRepoZip
(
activity
,
uri
,
false
).
exec
();
}
}
},
},
repo
.
getZipUrl
(),
repo
.
getZipUrl
(),
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/DownloadReceiver.java
View file @
bcdface6
...
@@ -12,7 +12,6 @@ import com.topjohnwu.magisk.R;
...
@@ -12,7 +12,6 @@ import com.topjohnwu.magisk.R;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
public
abstract
class
DownloadReceiver
extends
BroadcastReceiver
{
public
abstract
class
DownloadReceiver
extends
BroadcastReceiver
{
public
Context
mContext
;
public
String
mFilename
;
public
String
mFilename
;
long
downloadID
;
long
downloadID
;
...
@@ -20,7 +19,6 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
...
@@ -20,7 +19,6 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
mContext
=
context
;
DownloadManager
downloadManager
=
(
DownloadManager
)
context
.
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
downloadManager
=
(
DownloadManager
)
context
.
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
String
action
=
intent
.
getAction
();
String
action
=
intent
.
getAction
();
if
(
DownloadManager
.
ACTION_DOWNLOAD_COMPLETE
.
equals
(
action
))
{
if
(
DownloadManager
.
ACTION_DOWNLOAD_COMPLETE
.
equals
(
action
))
{
...
@@ -33,7 +31,7 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
...
@@ -33,7 +31,7 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
switch
(
status
)
{
switch
(
status
)
{
case
DownloadManager
.
STATUS_SUCCESSFUL
:
case
DownloadManager
.
STATUS_SUCCESSFUL
:
Uri
uri
=
Uri
.
parse
(
c
.
getString
(
c
.
getColumnIndex
(
DownloadManager
.
COLUMN_LOCAL_URI
)));
Uri
uri
=
Uri
.
parse
(
c
.
getString
(
c
.
getColumnIndex
(
DownloadManager
.
COLUMN_LOCAL_URI
)));
onDownloadDone
(
uri
);
onDownloadDone
(
uri
,
context
);
break
;
break
;
default
:
default
:
Toast
.
makeText
(
context
,
R
.
string
.
download_file_error
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
context
,
R
.
string
.
download_file_error
,
Toast
.
LENGTH_LONG
).
show
();
...
@@ -54,5 +52,5 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
...
@@ -54,5 +52,5 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
mFilename
=
filename
;
mFilename
=
filename
;
}
}
public
abstract
void
onDownloadDone
(
Uri
uri
);
public
abstract
void
onDownloadDone
(
Uri
uri
,
Context
context
);
}
}
app/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java
View file @
bcdface6
...
@@ -18,19 +18,19 @@ public class ManagerUpdate extends BroadcastReceiver {
...
@@ -18,19 +18,19 @@ public class ManagerUpdate extends BroadcastReceiver {
context
,
context
,
new
DownloadReceiver
()
{
new
DownloadReceiver
()
{
@Override
@Override
public
void
onDownloadDone
(
Uri
uri
)
{
public
void
onDownloadDone
(
Uri
uri
,
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_INSTALL_PACKAGE
);
Intent
install
=
new
Intent
(
Intent
.
ACTION_INSTALL_PACKAGE
);
install
.
setFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
install
.
setFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
Uri
content
=
FileProvider
.
getUriForFile
(
mC
ontext
,
Uri
content
=
FileProvider
.
getUriForFile
(
c
ontext
,
"com.topjohnwu.magisk.provider"
,
new
File
(
uri
.
getPath
()));
"com.topjohnwu.magisk.provider"
,
new
File
(
uri
.
getPath
()));
install
.
setData
(
content
);
install
.
setData
(
content
);
mC
ontext
.
startActivity
(
install
);
c
ontext
.
startActivity
(
install
);
}
else
{
}
else
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Intent
install
=
new
Intent
(
Intent
.
ACTION_VIEW
);
install
.
setDataAndType
(
uri
,
"application/vnd.android.package-archive"
);
install
.
setDataAndType
(
uri
,
"application/vnd.android.package-archive"
);
install
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
install
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
mC
ontext
.
startActivity
(
install
);
c
ontext
.
startActivity
(
install
);
}
}
}
}
},
},
...
...
Write
Preview
Markdown
is supported
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