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
441e603b
Commit
441e603b
authored
Sep 27, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update FlashZip to use Uri
parent
7511df61
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
161 additions
and
505 deletions
+161
-505
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
MagiskFragment.java
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
+5
-4
ModulesAdapter.java
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
+24
-196
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+3
-3
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+3
-21
DownloadReceiver.java
...java/com/topjohnwu/magisk/receivers/DownloadReceiver.java
+3
-3
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+83
-183
list_item_module.xml
app/src/main/res/layout/list_item_module.xml
+35
-91
strings.xml
app/src/main/res/values/strings.xml
+4
-3
No files found.
app/src/main/AndroidManifest.xml
View file @
441e603b
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
tools:ignore=
"AllowBackup,GoogleAppIndexingWarning"
>
tools:ignore=
"AllowBackup,GoogleAppIndexingWarning"
>
<service
<service
android:name=
".services.MonitorService"
android:name=
".services.MonitorService"
android:label=
"@string/a
ccessibility_service
_name"
android:label=
"@string/a
pp
_name"
android:permission=
"android.permission.BIND_ACCESSIBILITY_SERVICE"
>
android:permission=
"android.permission.BIND_ACCESSIBILITY_SERVICE"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.accessibilityservice.AccessibilityService"
/>
<action
android:name=
"android.accessibilityservice.AccessibilityService"
/>
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
441e603b
...
@@ -4,6 +4,7 @@ import android.app.Fragment;
...
@@ -4,6 +4,7 @@ import android.app.Fragment;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
...
@@ -138,8 +139,8 @@ public class MagiskFragment extends Fragment {
...
@@ -138,8 +139,8 @@ public class MagiskFragment extends Fragment {
getActivity
(),
getActivity
(),
new
DownloadReceiver
(
getString
(
R
.
string
.
magisk
))
{
new
DownloadReceiver
(
getString
(
R
.
string
.
magisk
))
{
@Override
@Override
public
void
task
(
File
file
)
{
public
void
task
(
Uri
uri
)
{
new
Async
.
FlashZIP
(
mContext
,
mName
,
file
.
getPath
()
).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
new
Async
.
FlashZIP
(
mContext
,
uri
).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
}
},
},
Utils
.
magiskLink
,
"latest_magisk.zip"
))
Utils
.
magiskLink
,
"latest_magisk.zip"
))
...
@@ -164,10 +165,10 @@ public class MagiskFragment extends Fragment {
...
@@ -164,10 +165,10 @@ public class MagiskFragment extends Fragment {
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
Utils
.
downloadAndReceive
(
getActivity
(),
.
setPositiveButton
(
R
.
string
.
download_install
,
(
dialogInterface
,
i
)
->
Utils
.
downloadAndReceive
(
getActivity
(),
new
DownloadReceiver
()
{
new
DownloadReceiver
()
{
@Override
@Override
public
void
task
(
File
file
)
{
public
void
task
(
Uri
uri
)
{
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
);
install
.
setData
(
FileProvider
.
getUriForFile
(
mContext
,
"com.topjohnwu.magisk.provider"
,
file
)
);
install
.
setData
(
uri
);
mContext
.
startActivity
(
install
);
mContext
.
startActivity
(
install
);
}
}
},
},
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
View file @
441e603b
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
View file @
441e603b
...
@@ -6,6 +6,7 @@ import android.animation.ValueAnimator;
...
@@ -6,6 +6,7 @@ import android.animation.ValueAnimator;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
...
@@ -147,9 +148,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
...
@@ -147,9 +148,8 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
DownloadReceiver
receiver
=
new
DownloadReceiver
()
{
DownloadReceiver
receiver
=
new
DownloadReceiver
()
{
@Override
@Override
public
void
task
(
File
file
)
{
public
void
task
(
Uri
uri
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Async
.
FlashZIP
(
context
,
uri
,
repo
.
getName
()
+
"-v"
+
repo
.
getVersion
());
new
Async
.
FlashZIP
(
context
,
repo
.
getId
(),
file
.
toString
()).
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
);
}
}
};
};
String
filename
=
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
;
String
filename
=
repo
.
getId
().
replace
(
" "
,
""
)
+
".zip"
;
...
...
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
441e603b
package
com
.
topjohnwu
.
magisk
.
module
;
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
...
@@ -13,13 +7,10 @@ public class Module extends BaseModule {
...
@@ -13,13 +7,10 @@ public class Module extends BaseModule {
private
String
mRemoveFile
;
private
String
mRemoveFile
;
private
String
mDisableFile
;
private
String
mDisableFile
;
private
String
mZipUrl
,
mLogUrl
;
private
boolean
mEnable
,
mRemove
,
mUpdateAvailable
=
false
;
private
boolean
mEnable
,
mRemove
,
mUpdateAvailable
=
false
;
public
Module
(
Context
context
,
String
path
)
{
public
Module
(
String
path
)
{
super
();
parseProps
(
Utils
.
readFile
(
path
+
"/module.prop"
));
parseProps
(
Utils
.
readFile
(
path
+
"/module.prop"
));
mRemoveFile
=
path
+
"/remove"
;
mRemoveFile
=
path
+
"/remove"
;
...
@@ -33,13 +24,7 @@ public class Module extends BaseModule {
...
@@ -33,13 +24,7 @@ public class Module extends BaseModule {
if
(
mName
==
null
)
if
(
mName
==
null
)
mName
=
mId
;
mName
=
mId
;
if
(
mDescription
==
null
)
Logger
.
dh
(
"Creating Module, id: "
+
mId
);
mDescription
=
context
.
getString
(
R
.
string
.
no_info_provided
);
if
(
mVersion
==
null
)
mVersion
=
context
.
getString
(
R
.
string
.
no_info_provided
);
Logger
.
dh
(
"Module id: "
+
mId
);
mEnable
=
!
Utils
.
itemExist
(
mDisableFile
);
mEnable
=
!
Utils
.
itemExist
(
mDisableFile
);
mRemove
=
Utils
.
itemExist
(
mRemoveFile
);
mRemove
=
Utils
.
itemExist
(
mRemoveFile
);
...
@@ -52,12 +37,11 @@ public class Module extends BaseModule {
...
@@ -52,12 +37,11 @@ public class Module extends BaseModule {
repo
.
setInstalled
();
repo
.
setInstalled
();
if
(
repo
.
getVersionCode
()
>
mVersionCode
)
{
if
(
repo
.
getVersionCode
()
>
mVersionCode
)
{
repo
.
setUpdate
();
repo
.
setUpdate
();
mUpdateAvailable
=
true
;
}
}
}
}
}
}
public
String
getmLogUrl
()
{
return
mLogUrl
;
}
public
void
createDisableFile
()
{
public
void
createDisableFile
()
{
mEnable
=
!
Utils
.
createFile
(
mDisableFile
);
mEnable
=
!
Utils
.
createFile
(
mDisableFile
);
}
}
...
@@ -82,8 +66,6 @@ public class Module extends BaseModule {
...
@@ -82,8 +66,6 @@ public class Module extends BaseModule {
return
mRemove
;
return
mRemove
;
}
}
public
String
getmZipUrl
()
{
return
mZipUrl
;
}
public
boolean
isUpdateAvailable
()
{
return
mUpdateAvailable
;
}
public
boolean
isUpdateAvailable
()
{
return
mUpdateAvailable
;
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/receivers/DownloadReceiver.java
View file @
441e603b
...
@@ -38,8 +38,8 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
...
@@ -38,8 +38,8 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
int
status
=
c
.
getInt
(
columnIndex
);
int
status
=
c
.
getInt
(
columnIndex
);
switch
(
status
)
{
switch
(
status
)
{
case
DownloadManager
.
STATUS_SUCCESSFUL
:
case
DownloadManager
.
STATUS_SUCCESSFUL
:
File
file
=
new
File
(
Uri
.
parse
(
c
.
getString
(
c
.
getColumnIndex
(
DownloadManager
.
COLUMN_LOCAL_URI
))).
getPath
(
));
Uri
uri
=
Uri
.
parse
(
c
.
getString
(
c
.
getColumnIndex
(
DownloadManager
.
COLUMN_LOCAL_URI
)
));
task
(
file
);
task
(
uri
);
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 +54,5 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
...
@@ -54,5 +54,5 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
downloadID
=
id
;
downloadID
=
id
;
}
}
public
abstract
void
task
(
File
file
);
public
void
task
(
Uri
uri
)
{}
}
}
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
441e603b
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/list_item_module.xml
View file @
441e603b
...
@@ -41,18 +41,51 @@
...
@@ -41,18 +41,51 @@
android:layout_alignParentStart=
"true"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/title"
android:layout_below=
"@id/title"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:text=
"@string/no_info_provided"
android:textColor=
"@android:color/tertiary_text_dark"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
android:textStyle=
"bold|italic"
/>
<TextView
android:id=
"@+id/author"
android:layout_width=
"@dimen/card_textview_width"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/version_name"
android:text=
"@string/no_info_provided"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
<TextView
android:id=
"@+id/description"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/author"
android:layout_gravity=
"center_vertical"
android:text=
"@string/no_info_provided"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/warning"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/description"
android:layout_gravity=
"center_vertical"
android:text=
"@string/remove_file_created"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/red500"
android:visibility=
"gone"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_above=
"@+id/expand_layout"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentTop=
"true"
android:layout_alignParentTop=
"true"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
android:paddingTop=
"
15
dp"
>
android:paddingTop=
"
20
dp"
>
<CheckBox
<CheckBox
...
@@ -90,95 +123,6 @@
...
@@ -90,95 +123,6 @@
<!--android:layout_alignBaseline="@id/title"-->
<!--android:layout_alignBaseline="@id/title"-->
<!--android:layout_alignParentEnd="true"-->
<!--android:layout_alignParentEnd="true"-->
<!--/>-->
<!--/>-->
<TextView
android:id=
"@+id/description"
android:layout_width=
"@dimen/card_textview_width"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/version_name"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/warning"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/description"
android:layout_gravity=
"center_vertical"
android:text=
"@string/remove_file_created"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/red500"
android:visibility=
"gone"
/>
<LinearLayout
android:id=
"@+id/expand_layout"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_below=
"@id/description"
android:minHeight=
"70dp"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/author"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
<TextView
android:id=
"@+id/updateStatus"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginBottom=
"20dip"
android:gravity=
"center_horizontal"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"40dip"
android:layout_gravity=
"center"
android:layout_marginBottom=
"0dip"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/changeLog"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:background=
"@drawable/ic_changelog"
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
android:id=
"@+id/authorLink"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:background=
"@drawable/ic_author"
android:backgroundTint=
"@color/icon_grey"
/>
<ImageView
android:id=
"@+id/supportLink"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/card_imageview_margin"
android:layout_marginStart=
"@dimen/card_imageview_margin"
android:background=
"@drawable/ic_support"
android:backgroundTint=
"@color/icon_grey"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
...
...
app/src/main/res/values/strings.xml
View file @
441e603b
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
<string
name=
"remove_file_deleted"
>
Module will not be removed at next reboot
</string>
<string
name=
"remove_file_deleted"
>
Module will not be removed at next reboot
</string>
<string
name=
"disable_file_created"
>
Module will be disabled at next reboot
</string>
<string
name=
"disable_file_created"
>
Module will be disabled at next reboot
</string>
<string
name=
"disable_file_removed"
>
Module will be enabled at next reboot
</string>
<string
name=
"disable_file_removed"
>
Module will be enabled at next reboot
</string>
<string
name=
"author"
>
Created by
</string>
<string
name=
"author"
>
Created by
%1$s
</string>
<!--Log Fragment-->
<!--Log Fragment-->
<string
name=
"menuSaveToSd"
>
Save to SD
</string>
<string
name=
"menuSaveToSd"
>
Save to SD
</string>
...
@@ -83,12 +83,12 @@
...
@@ -83,12 +83,12 @@
<string
name=
"no_root_access"
>
No root access, functionality limited
</string>
<string
name=
"no_root_access"
>
No root access, functionality limited
</string>
<string
name=
"no_thanks"
>
No thanks
</string>
<string
name=
"no_thanks"
>
No thanks
</string>
<string
name=
"accessibility_service_description"
>
Accessibility service required for Magisk auto-unroot feature
</string>
<string
name=
"accessibility_service_description"
>
Accessibility service required for Magisk auto-unroot feature
</string>
<string
name=
"accessibility_service_name"
>
Magisk Manager
</string>
<string
name=
"update_title"
>
%1$s Update!
</string>
<string
name=
"update_title"
>
%1$s Update!
</string>
<string
name=
"update_msg"
>
New version v%2$s of %1$s is available!\nChangelog:\n%3$s
</string>
<string
name=
"update_msg"
>
New version v%2$s of %1$s is available!\nChangelog:\n%3$s
</string>
<string
name=
"download_install"
>
Download and install
</string>
<string
name=
"download_install"
>
Download and install
</string>
<string
name=
"download_file_error"
>
Error downloading file
</string>
<string
name=
"download_file_error"
>
Error downloading file
</string>
<string
name=
"manual_install"
>
File downloaded in %1$s\nFlash it in recovery manually
</string>
<string
name=
"install_error"
>
Installation error!
</string>
<string
name=
"manual_install"
>
Error in flashing file, zip file placed in %1$s\nFlash it in recovery manually
</string>
<string
name=
"reboot_title"
>
Installation succeeded!
</string>
<string
name=
"reboot_title"
>
Installation succeeded!
</string>
<string
name=
"reboot_msg"
>
Do you want to reboot now?
</string>
<string
name=
"reboot_msg"
>
Do you want to reboot now?
</string>
<string
name=
"reboot"
>
Reboot
</string>
<string
name=
"reboot"
>
Reboot
</string>
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
<string
name=
"supersu"
>
SuperSU
</string>
<string
name=
"supersu"
>
SuperSU
</string>
<string
name=
"root_system_msg"
>
It seems that you have incompatible root installed\nDo you want to install Magisk compatible root now?
</string>
<string
name=
"root_system_msg"
>
It seems that you have incompatible root installed\nDo you want to install Magisk compatible root now?
</string>
<!--Web Related-->
<string
name=
"pass"
>
MagiskRox666
</string>
<string
name=
"pass"
>
MagiskRox666
</string>
<string
name=
"some_string"
>
GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus
</string>
<string
name=
"some_string"
>
GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus
</string>
<string
name=
"downloads"
>
Downloads
</string>
<string
name=
"downloads"
>
Downloads
</string>
...
...
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