Version 1.18.4
This commit is contained in:
parent
68ad318388
commit
e399a217e5
269
.idea/codeStyleSettings.xml
generated
269
.idea/codeStyleSettings.xml
generated
@ -44,125 +44,153 @@
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
@ -170,5 +198,4 @@
|
||||
</option>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
</project>
|
4
.idea/gradle.xml
generated
4
.idea/gradle.xml
generated
@ -6,6 +6,7 @@
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.2.1" />
|
||||
<option name="gradleJvm" value="1.7" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
@ -19,5 +20,4 @@
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
</project>
|
@ -22,7 +22,6 @@
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
|
@ -23,7 +23,6 @@
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/classes.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="6c6578ebabff77c87854baf7be7657d9e4df7ce0">
|
||||
sha1="4d7789a42ceff3f474240180bb105f60d1ed9584">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/release/classes-7af851cddf38d5159407b847c0234eebc467ba34.jar" />
|
||||
</item>
|
||||
<item
|
||||
@ -99,6 +99,13 @@
|
||||
sha1="b1b6ea3b7e4aa4f492509a4952029cd8e48019ad">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/commons-io-2.4-b13b4a70538d465dbbcce6e080f59071eeb53a3a.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.3.2/90a3822c38ec8c996e84c16a3477ef632cbc87a3/commons-lang3-3.3.2.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="90a3822c38ec8c996e84c16a3477ef632cbc87a3">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/debug/commons-lang3-3.3.2-7f7acab4beba98152ec8688230189df57d6b569d.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/libs/markdownview-1.2.jar"
|
||||
jumboMode="false"
|
||||
@ -106,13 +113,6 @@
|
||||
sha1="6dfceaa4daa04ee7ed4cdda1157e3de8ede56a90">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/release/markdownview-1.2-745b49cf0734056f6bf19a01501c4cea20a542b5.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/.gradle/caches/modules-2/files-2.1/com.nineoldandroids/library/2.4.0/e9b63380f3a242dbdbf103a2355ad7e43bad17cb/library-2.4.0.jar"
|
||||
jumboMode="false"
|
||||
revision="21.1.2"
|
||||
sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/library-2.4.0-fcd7bf57330797c3eaeb05d042207c4ab7ecac63.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/libs/markdownview-1.2.jar"
|
||||
jumboMode="false"
|
||||
@ -120,6 +120,13 @@
|
||||
sha1="6dfceaa4daa04ee7ed4cdda1157e3de8ede56a90">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/release/markdownview-1.2-1443999e5c62160ed6b8f07c2786bbf1f7558e8f.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/.gradle/caches/modules-2/files-2.1/com.nineoldandroids/library/2.4.0/e9b63380f3a242dbdbf103a2355ad7e43bad17cb/library-2.4.0.jar"
|
||||
jumboMode="false"
|
||||
revision="21.1.2"
|
||||
sha1="e9b63380f3a242dbdbf103a2355ad7e43bad17cb">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/library-2.4.0-fcd7bf57330797c3eaeb05d042207c4ab7ecac63.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/libs/juniversalchardet-1.0.3.jar"
|
||||
jumboMode="false"
|
||||
@ -141,20 +148,6 @@
|
||||
sha1="0d6546c1c73cb64a6907f694e6c4bf4b50fefa70">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/release/classes-d7c3cbd32b25008f71bfaf501c6d05efb73f9642.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="905075e6c80f206bbe6cf1e809d2caa69f420c76">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/commons-lang3-3.1-b10c93b68b275dbbda03ac96f3dca1760aaa7c91.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/turbo-editor.libraries/RootCommands/unspecified/classes.jar"
|
||||
jumboMode="false"
|
||||
revision="21.1.2"
|
||||
sha1="8fc5121de38525c53e82648c80cf0a9818b956ff">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/debug/classes-8e353cdc5188a33b2ae051656b4023deec32169f.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/com.github.gabrielemariotti.changeloglib/library/1.5.1/classes.jar"
|
||||
jumboMode="false"
|
||||
@ -162,6 +155,13 @@
|
||||
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/release/classes-378a7c750e497deeb602597a239d4846198295a3.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="905075e6c80f206bbe6cf1e809d2caa69f420c76">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/commons-lang3-3.1-b10c93b68b275dbbda03ac96f3dca1760aaa7c91.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/libs/juniversalchardet-1.0.3-sources.jar"
|
||||
jumboMode="false"
|
||||
@ -211,6 +211,13 @@
|
||||
sha1="6e76d33df7ad4d766237d97bbc4373abedaddbba">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/release/classes-f678c74688f3e132a975f931e58b6be06968cfee.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/com.github.gabrielemariotti.changeloglib/library/1.5.2/classes.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="494089d9d84042634d2be0355702e96805f847d3">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/debug/classes-b88530eb78de039b58ee6a7a2eaba38644fbd65a.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/libs/juniversalchardet-1.0.3.jar"
|
||||
jumboMode="false"
|
||||
@ -232,13 +239,6 @@
|
||||
sha1="685d0b2c590447e85284ed84712cb363ba04eff8">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-80c86d146355d4d279469a404f782b1bd07b46c1.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/exploded-aar/com.github.gabrielemariotti.changeloglib/library/1.5.1/classes.jar"
|
||||
jumboMode="false"
|
||||
revision="21.1.2"
|
||||
sha1="74a89f0f8b56d9f11d70b8d8134cf4109f4797dc">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app/build/intermediates/pre-dexed/debug/classes-378a7c750e497deeb602597a239d4846198295a3.jar" />
|
||||
</item>
|
||||
<item
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/classes.jar"
|
||||
jumboMode="false"
|
||||
@ -278,7 +278,7 @@
|
||||
jar="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/exploded-aar/turbo-editor.libraries/sharedCode/unspecified/classes.jar"
|
||||
jumboMode="false"
|
||||
revision="22.0.0"
|
||||
sha1="6c6578ebabff77c87854baf7be7657d9e4df7ce0">
|
||||
sha1="4d7789a42ceff3f474240180bb105f60d1ed9584">
|
||||
<dex dex="/Users/mac/AndroidStudioProjects/turbo-editor/app-pro/build/intermediates/pre-dexed/debug/classes-d2f158f0c6d8e71984e1b2f52f7c248ddf421cff.jar" />
|
||||
</item>
|
||||
|
||||
|
@ -61,14 +61,14 @@ dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':libraries:FloatingActionButton')
|
||||
// compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
|
||||
compile 'org.apache.commons:commons-lang3:3.1'
|
||||
compile 'org.apache.commons:commons-lang3:+'
|
||||
compile files('libs/juniversalchardet-1.0.3.jar')
|
||||
compile('com.android.support:appcompat-v7:22.+') {
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
}
|
||||
compile 'com.android.support:support-v4:22.+'
|
||||
compile 'com.github.gabrielemariotti.changeloglib:library:1.5.1'
|
||||
compile 'com.github.gabrielemariotti.changeloglib:library:+'
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'com.android.support:support-annotations:20.0.0'
|
||||
compile 'com.android.support:support-annotations:+'
|
||||
compile files('libs/markdownview-1.2.jar')
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4;
|
||||
@ -39,7 +39,7 @@ import com.spazedog.lib.rootfw4.utils.io.FileReader;
|
||||
import com.spazedog.lib.rootfw4.utils.io.FileWriter;
|
||||
|
||||
/**
|
||||
* This is a global static front-end to {@link com.spazedog.lib.rootfw4.Shell}. It allows one global shell connection to be
|
||||
* This is a global static front-end to {@link Shell}. It allows one global shell connection to be
|
||||
* easily shared across classes and threads without having to create multiple connections.
|
||||
*/
|
||||
public class RootFW {
|
||||
@ -53,7 +53,7 @@ public class RootFW {
|
||||
/**
|
||||
* An interface that can be used to monitor the current state of the global connection.
|
||||
*
|
||||
* @see #addConnectionListener(com.spazedog.lib.rootfw4.RootFW.OnConnectionListener)
|
||||
* @see #addConnectionListener(OnConnectionListener)
|
||||
*/
|
||||
public static interface OnConnectionListener extends OnShellConnectionListener {
|
||||
/**
|
||||
@ -164,9 +164,9 @@ public class RootFW {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link com.spazedog.lib.rootfw4.RootFW.OnConnectionListener} to the global shell
|
||||
* Add a new {@link OnConnectionListener} to the global shell
|
||||
*
|
||||
* @see #removeConnectionListener(com.spazedog.lib.rootfw4.RootFW.OnConnectionListener)
|
||||
* @see #removeConnectionListener(OnConnectionListener)
|
||||
*/
|
||||
public static void addConnectionListener(OnConnectionListener listener) {
|
||||
synchronized(mLock) {
|
||||
@ -175,9 +175,9 @@ public class RootFW {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a {@link com.spazedog.lib.rootfw4.RootFW.OnConnectionListener} from the global shell
|
||||
* Remove a {@link OnConnectionListener} from the global shell
|
||||
*
|
||||
* @see #addConnectionListener(com.spazedog.lib.rootfw4.RootFW.OnConnectionListener)
|
||||
* @see #addConnectionListener(OnConnectionListener)
|
||||
*/
|
||||
public static void removeConnectionListener(OnConnectionListener listener) {
|
||||
synchronized(mLock) {
|
||||
@ -186,161 +186,161 @@ public class RootFW {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String)
|
||||
* @see Shell#execute(String)
|
||||
*/
|
||||
public static Result execute(String command) {
|
||||
return mShell.execute(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String[])
|
||||
* @see Shell#execute(String[])
|
||||
*/
|
||||
public static Result execute(String[] commands) {
|
||||
return mShell.execute(commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String[], Integer[], com.spazedog.lib.rootfw4.Shell.OnShellValidateListener)
|
||||
* @see Shell#execute(String[], Integer[], OnShellValidateListener)
|
||||
*/
|
||||
public static Result execute(String[] commands, Integer[] resultCodes, OnShellValidateListener validater) {
|
||||
return mShell.execute(commands, resultCodes, validater);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#executeAsync(String, com.spazedog.lib.rootfw4.Shell.OnShellResultListener)
|
||||
* @see Shell#executeAsync(String, OnShellResultListener)
|
||||
*/
|
||||
public static void executeAsync(String command, OnShellResultListener listener) {
|
||||
mShell.executeAsync(command, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#executeAsync(String[], com.spazedog.lib.rootfw4.Shell.OnShellResultListener)
|
||||
* @see Shell#executeAsync(String[], OnShellResultListener)
|
||||
*/
|
||||
public static void executeAsync(String[] commands, OnShellResultListener listener) {
|
||||
mShell.executeAsync(commands, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#executeAsync(String[], Integer[], com.spazedog.lib.rootfw4.Shell.OnShellValidateListener, com.spazedog.lib.rootfw4.Shell.OnShellResultListener)
|
||||
* @see Shell#executeAsync(String[], Integer[], OnShellValidateListener, OnShellResultListener)
|
||||
*/
|
||||
public static void executeAsync(String[] commands, Integer[] resultCodes, OnShellValidateListener validater, OnShellResultListener listener) {
|
||||
mShell.executeAsync(commands, resultCodes, validater, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#isRoot()
|
||||
* @see Shell#isRoot()
|
||||
*/
|
||||
public static Boolean isRoot() {
|
||||
return mShell.isRoot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#isConnected()
|
||||
* @see Shell#isConnected()
|
||||
*/
|
||||
public static Boolean isConnected() {
|
||||
return mShell != null && mShell.isConnected();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getTimeout()
|
||||
* @see Shell#getTimeout()
|
||||
*/
|
||||
public static Integer getTimeout() {
|
||||
return mShell.getTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#setTimeout(Integer)
|
||||
* @see Shell#setTimeout(Integer)
|
||||
*/
|
||||
public static void setTimeout(Integer timeout) {
|
||||
mShell.setTimeout(timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getBinary(String)
|
||||
* @see Shell#getBinary(String)
|
||||
*/
|
||||
public static String findCommand(String bin) {
|
||||
return mShell.findCommand(bin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#createAttempts(String)
|
||||
* @see Shell#createAttempts(String)
|
||||
*/
|
||||
public static Attempts createAttempts(String command) {
|
||||
return mShell.createAttempts(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getFileReader(String)
|
||||
* @see Shell#getFileReader(String)
|
||||
*/
|
||||
public static FileReader getFileReader(String file) {
|
||||
return mShell.getFileReader(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getFileWriter(String, Boolean)
|
||||
* @see Shell#getFileWriter(String, Boolean)
|
||||
*/
|
||||
public static FileWriter getFileWriter(String file, Boolean append) {
|
||||
return mShell.getFileWriter(file, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getFile(String)
|
||||
* @see Shell#getFile(String)
|
||||
*/
|
||||
public static File getFile(String file) {
|
||||
return mShell.getFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getFilesystem()
|
||||
* @see Shell#getFilesystem()
|
||||
*/
|
||||
public static Filesystem getFilesystem() {
|
||||
return mShell.getFilesystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getDisk(String)
|
||||
* @see Shell#getDisk(String)
|
||||
*/
|
||||
public static Disk getDisk(String disk) {
|
||||
return mShell.getDisk(disk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getDevice()
|
||||
* @see Shell#getDevice()
|
||||
*/
|
||||
public static Device getDevice() {
|
||||
return mShell.getDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getProcess(String)
|
||||
* @see Shell#getProcess(String)
|
||||
*/
|
||||
public static Process getProcess(String process) {
|
||||
return mShell.getProcess(process);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getProcess(Integer)
|
||||
* @see Shell#getProcess(Integer)
|
||||
*/
|
||||
public static Process getProcess(Integer pid) {
|
||||
return mShell.getProcess(pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getMemory()
|
||||
* @see Shell#getMemory()
|
||||
*/
|
||||
public static Memory getMemory() {
|
||||
return mShell.getMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getCompCache()
|
||||
* @see Shell#getCompCache()
|
||||
*/
|
||||
public static CompCache getCompCache() {
|
||||
return mShell.getCompCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.Shell#getSwap(String device)
|
||||
* @see Shell#getSwap(String device)
|
||||
*/
|
||||
public static Swap getSwap(String device) {
|
||||
return mShell.getSwap(device);
|
||||
|
@ -19,6 +19,17 @@
|
||||
|
||||
package com.spazedog.lib.rootfw4;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
@ -35,17 +46,6 @@ import com.spazedog.lib.rootfw4.utils.Memory.Swap;
|
||||
import com.spazedog.lib.rootfw4.utils.io.FileReader;
|
||||
import com.spazedog.lib.rootfw4.utils.io.FileWriter;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* This class is a front-end to {@link ShellStream} which makes it easier to work
|
||||
* with normal shell executions. If you need to execute a consistent command (one that never ends),
|
||||
@ -77,7 +77,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is for use with {@link com.spazedog.lib.rootfw4.Shell#executeAsync(String[], com.spazedog.lib.rootfw4.Shell.OnShellResultListener)}.
|
||||
* This interface is for use with {@link Shell#executeAsync(String[], OnShellResultListener)}.
|
||||
*/
|
||||
public static interface OnShellResultListener {
|
||||
/**
|
||||
@ -127,7 +127,7 @@ public class Shell {
|
||||
|
||||
/**
|
||||
* This class is used to store the result from shell executions.
|
||||
* It extends the {@link com.spazedog.lib.rootfw4.containers.Data} class.
|
||||
* It extends the {@link Data} class.
|
||||
*/
|
||||
public static class Result extends Data<Result> {
|
||||
private Integer mResultCode;
|
||||
@ -150,7 +150,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the result code with {@link com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)} to determine
|
||||
* Compare the result code with {@link Shell#addResultCode(Integer)} to determine
|
||||
* whether or not the execution was a success.
|
||||
*/
|
||||
public Boolean wasSuccessful() {
|
||||
@ -172,7 +172,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* A class containing automatically created shell attempts and links to both {@link com.spazedog.lib.rootfw4.Shell#executeAsync(String[], Integer[], com.spazedog.lib.rootfw4.Shell.OnShellResultListener)} and {@link com.spazedog.lib.rootfw4.Shell#execute(String[], Integer[])} <br /><br />
|
||||
* A class containing automatically created shell attempts and links to both {@link Shell#executeAsync(String[], Integer[], OnShellResultListener)} and {@link Shell#execute(String[], Integer[])} <br /><br />
|
||||
*
|
||||
* All attempts are created based on {@link Common#BINARIES}. <br /><br />
|
||||
*
|
||||
@ -182,7 +182,7 @@ public class Shell {
|
||||
*
|
||||
* Example: String("(%binary test -d '%binary pwd') || exit 1") would become String["(test -d 'pwd') || exit 1", "(busybox test -d 'busybox pwd') || exit 1", "(toolbox test -d 'toolbox pwd') || exit 1"]
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#createAttempts(String)
|
||||
* @see Shell#createAttempts(String)
|
||||
*/
|
||||
public class Attempts {
|
||||
protected String[] mAttempts;
|
||||
@ -322,7 +322,7 @@ public class Shell {
|
||||
/**
|
||||
* Execute a shell command.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String[], Integer[])
|
||||
* @see Shell#execute(String[], Integer[])
|
||||
*
|
||||
* @param command
|
||||
* The command to execute
|
||||
@ -334,7 +334,7 @@ public class Shell {
|
||||
/**
|
||||
* Execute a range of commands until one is successful.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String[], Integer[])
|
||||
* @see Shell#execute(String[], Integer[])
|
||||
*
|
||||
* @param commands
|
||||
* The commands to try
|
||||
@ -351,17 +351,17 @@ public class Shell {
|
||||
*
|
||||
* <code>Shell.execute( new String(){"cat file", "toolbox cat file", "busybox cat file"} );</code><br /><br />
|
||||
*
|
||||
* Whether or not a command was successful, depends on {@link com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)} which by default only contains '0'.
|
||||
* The command number that was successful can be checked using {@link com.spazedog.lib.rootfw4.Shell.Result#getCommandNumber()}.
|
||||
* Whether or not a command was successful, depends on {@link Shell#addResultCode(Integer)} which by default only contains '0'.
|
||||
* The command number that was successful can be checked using {@link Result#getCommandNumber()}.
|
||||
*
|
||||
* @param commands
|
||||
* The commands to try
|
||||
*
|
||||
* @param resultCodes
|
||||
* Result Codes representing successful execution. These will be temp. merged with {@link com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)}.
|
||||
* Result Codes representing successful execution. These will be temp. merged with {@link Shell#addResultCode(Integer)}.
|
||||
*
|
||||
* @param validater
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellValidateListener} instance or NULL
|
||||
* A {@link OnShellValidateListener} instance or NULL
|
||||
*/
|
||||
public Result execute(String[] commands, Integer[] resultCodes, OnShellValidateListener validater) {
|
||||
synchronized(mLock) {
|
||||
@ -399,7 +399,9 @@ public class Shell {
|
||||
cmdCount += 1;
|
||||
}
|
||||
|
||||
return new Result(mOutput.toArray(new String[mOutput.size()]), mResultCode, codes.toArray(new Integer[codes.size()]), cmdCount);
|
||||
if (mOutput != null) {
|
||||
return new Result(mOutput.toArray(new String[mOutput.size()]), mResultCode, codes.toArray(new Integer[codes.size()]), cmdCount);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -409,13 +411,13 @@ public class Shell {
|
||||
/**
|
||||
* Execute a shell command asynchronous.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#executeAsync(String[], Integer[], com.spazedog.lib.rootfw4.Shell.OnShellResultListener)
|
||||
* @see Shell#executeAsync(String[], Integer[], OnShellResultListener)
|
||||
*
|
||||
* @param command
|
||||
* The command to execute
|
||||
*
|
||||
* @param listener
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellResultListener} callback instance
|
||||
* A {@link OnShellResultListener} callback instance
|
||||
*/
|
||||
public void executeAsync(String command, OnShellResultListener listener) {
|
||||
executeAsync(new String[]{command}, null, null, listener);
|
||||
@ -424,13 +426,13 @@ public class Shell {
|
||||
/**
|
||||
* Execute a range of commands asynchronous until one is successful.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#executeAsync(String[], Integer[], com.spazedog.lib.rootfw4.Shell.OnShellResultListener)
|
||||
* @see Shell#executeAsync(String[], Integer[], OnShellResultListener)
|
||||
*
|
||||
* @param commands
|
||||
* The commands to try
|
||||
*
|
||||
* @param listener
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellResultListener} callback instance
|
||||
* A {@link OnShellResultListener} callback instance
|
||||
*/
|
||||
public void executeAsync(String[] commands, OnShellResultListener listener) {
|
||||
executeAsync(commands, null, null, listener);
|
||||
@ -439,19 +441,19 @@ public class Shell {
|
||||
/**
|
||||
* Execute a range of commands asynchronous until one is successful.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#execute(String[], Integer[])
|
||||
* @see Shell#execute(String[], Integer[])
|
||||
*
|
||||
* @param commands
|
||||
* The commands to try
|
||||
*
|
||||
* @param resultCodes
|
||||
* Result Codes representing successful execution. These will be temp. merged with {@link com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)}.
|
||||
* Result Codes representing successful execution. These will be temp. merged with {@link Shell#addResultCode(Integer)}.
|
||||
*
|
||||
* @param validater
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellValidateListener} instance or NULL
|
||||
* A {@link OnShellValidateListener} instance or NULL
|
||||
*
|
||||
* @param listener
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellResultListener} callback instance
|
||||
* A {@link OnShellResultListener} callback instance
|
||||
*/
|
||||
public synchronized void executeAsync(final String[] commands, final Integer[] resultCodes, final OnShellValidateListener validater, final OnShellResultListener listener) {
|
||||
if(Common.DEBUG)Log.d(TAG, "executeAsync: Starting an async shell execution");
|
||||
@ -521,7 +523,7 @@ public class Shell {
|
||||
* the shell changes.
|
||||
*
|
||||
* @param listener
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellConnectionListener} callback instance
|
||||
* A {@link OnShellConnectionListener} callback instance
|
||||
*/
|
||||
public void addShellConnectionListener(OnShellConnectionListener listener) {
|
||||
mConnectionRecievers.add(listener);
|
||||
@ -531,7 +533,7 @@ public class Shell {
|
||||
* Remove a shell connection listener from the stack.
|
||||
*
|
||||
* @param listener
|
||||
* A {@link com.spazedog.lib.rootfw4.Shell.OnShellConnectionListener} callback instance
|
||||
* A {@link OnShellConnectionListener} callback instance
|
||||
*/
|
||||
public void removeShellConnectionListener(OnShellConnectionListener listener) {
|
||||
mConnectionRecievers.remove(listener);
|
||||
@ -583,7 +585,7 @@ public class Shell {
|
||||
/**
|
||||
* Remove a result code from the stack.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)
|
||||
* @see Shell#addResultCode(Integer)
|
||||
*
|
||||
* @param resultCode
|
||||
* The result code to remove from the stack
|
||||
@ -595,7 +597,7 @@ public class Shell {
|
||||
/**
|
||||
* Reset the stack containing result codes and set it back to default only containing '0'.
|
||||
*
|
||||
* @see com.spazedog.lib.rootfw4.Shell#addResultCode(Integer)
|
||||
* @see Shell#addResultCode(Integer)
|
||||
*/
|
||||
public void resetResultCodes() {
|
||||
mResultCodes.clear();
|
||||
@ -654,7 +656,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of {@link com.spazedog.lib.rootfw4.Shell.Attempts}
|
||||
* Create a new instance of {@link Attempts}
|
||||
*
|
||||
* @param command
|
||||
* The command to convert into multiple attempts
|
||||
@ -668,7 +670,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new RootFW {@link com.spazedog.lib.rootfw4.utils.io.FileReader}. This is the same as {@link com.spazedog.lib.rootfw4.utils.io.FileReader#FileReader(com.spazedog.lib.rootfw4.Shell, String)}.
|
||||
* Open a new RootFW {@link FileReader}. This is the same as {@link FileReader#FileReader(Shell, String)}.
|
||||
*
|
||||
* @param file
|
||||
* Path to the file
|
||||
@ -686,7 +688,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new RootFW {@link com.spazedog.lib.rootfw4.utils.io.FileWriter}. This is the same as {@link com.spazedog.lib.rootfw4.utils.io.FileWriter#FileWriter(com.spazedog.lib.rootfw4.Shell, String, boolean)}.
|
||||
* Open a new RootFW {@link FileWriter}. This is the same as {@link FileWriter#FileWriter(Shell, String, boolean)}.
|
||||
*
|
||||
* @param file
|
||||
* Path to the file
|
||||
@ -707,7 +709,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.File} instance.
|
||||
* Get a new {@link File} instance.
|
||||
*
|
||||
* @param file
|
||||
* Path to the file or directory
|
||||
@ -717,14 +719,14 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Filesystem} instance.
|
||||
* Get a new {@link Filesystem} instance.
|
||||
*/
|
||||
public Filesystem getFilesystem() {
|
||||
return new Filesystem(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Filesystem.Disk} instance.
|
||||
* Get a new {@link Disk} instance.
|
||||
*
|
||||
* @param disk
|
||||
* Path to a disk, partition or a mount point
|
||||
@ -735,14 +737,14 @@ public class Shell {
|
||||
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Device} instance.
|
||||
* Get a new {@link Device} instance.
|
||||
*/
|
||||
public Device getDevice() {
|
||||
return new Device(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Device.Process} instance.
|
||||
* Get a new {@link Process} instance.
|
||||
*
|
||||
* @param process
|
||||
* The name of the process
|
||||
@ -752,7 +754,7 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Device.Process} instance.
|
||||
* Get a new {@link Process} instance.
|
||||
*
|
||||
* @param pid
|
||||
* The process id
|
||||
@ -762,21 +764,21 @@ public class Shell {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Memory} instance.
|
||||
* Get a new {@link Memory} instance.
|
||||
*/
|
||||
public Memory getMemory() {
|
||||
return new Memory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Memory.CompCache} instance.
|
||||
* Get a new {@link CompCache} instance.
|
||||
*/
|
||||
public CompCache getCompCache() {
|
||||
return new CompCache(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Memory.Swap} instance.
|
||||
* Get a new {@link Swap} instance.
|
||||
*
|
||||
* @param device
|
||||
* The /dev/ swap device
|
||||
|
@ -30,7 +30,7 @@ import android.util.Log;
|
||||
|
||||
/**
|
||||
* This class opens a connection to the shell and creates a consistent output stream
|
||||
* that can be read using the {@link com.spazedog.lib.rootfw4.ShellStream.OnStreamListener} interface. It also
|
||||
* that can be read using the {@link OnStreamListener} interface. It also
|
||||
* contains an input stream that can be used to execute shell commands.
|
||||
*/
|
||||
public class ShellStream {
|
||||
@ -108,7 +108,7 @@ public class ShellStream {
|
||||
|
||||
/**
|
||||
* This is called when the shell connection dies.
|
||||
* This can either be because a command executed 'exit', or if the method {@link com.spazedog.lib.rootfw4.ShellStream#destroy()} was called.
|
||||
* This can either be because a command executed 'exit', or if the method {@link ShellStream#destroy()} was called.
|
||||
*/
|
||||
public void onStreamDied();
|
||||
}
|
||||
@ -138,11 +138,16 @@ public class ShellStream {
|
||||
try {
|
||||
while (mIsActive && (output = mStdOutput.readLine()) != null) {
|
||||
if (mListener != null && mCounter.size() > 0) {
|
||||
if (output.startsWith(mCommandEnd)) {
|
||||
if (output.contains(mCommandEnd)) {
|
||||
Integer result = 0;
|
||||
|
||||
try {
|
||||
result = Integer.parseInt(output.substring(mCommandEnd.length()+1));
|
||||
if (output.startsWith(mCommandEnd)) {
|
||||
result = Integer.parseInt(output.substring(mCommandEnd.length()+1));
|
||||
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.w(TAG, e.getMessage(), e);
|
||||
@ -182,7 +187,7 @@ public class ShellStream {
|
||||
* Send a command to the shell input stream.<br /><br />
|
||||
*
|
||||
* This method is executed asynchronous. If you need to wait until the command finishes,
|
||||
* then use {@link com.spazedog.lib.rootfw4.ShellStream#waitFor()}.
|
||||
* then use {@link ShellStream#waitFor()}.
|
||||
*
|
||||
* @param command
|
||||
* The command to send to the shell
|
||||
@ -204,7 +209,7 @@ public class ShellStream {
|
||||
mListener.onStreamStart();
|
||||
|
||||
String input = command + "\n";
|
||||
input += "echo " + mCommandEnd + " $?\n";
|
||||
input += " echo " + mCommandEnd + " $?\n";
|
||||
|
||||
try {
|
||||
mStdInput.write( input.getBytes() );
|
||||
@ -237,7 +242,7 @@ public class ShellStream {
|
||||
/**
|
||||
* Sleeps until the shell is done with a current command and ready for new input.
|
||||
*
|
||||
* @see {@link com.spazedog.lib.rootfw4.ShellStream#waitFor(Integer)}
|
||||
* @see {@link ShellStream#waitFor(Integer)}
|
||||
*
|
||||
* @return
|
||||
* True if the shell connection is OK or false on connection error
|
||||
@ -327,7 +332,7 @@ public class ShellStream {
|
||||
/**
|
||||
* Close the shell connection. <br /><br />
|
||||
*
|
||||
* This will force close the connection. Use this only when running a consistent command (if {@link com.spazedog.lib.rootfw4.ShellStream#isRunning()} returns true).
|
||||
* This will force close the connection. Use this only when running a consistent command (if {@link ShellStream#isRunning()} returns true).
|
||||
* When possible, sending the 'exit' command to the shell is a better choice. <br /><br />
|
||||
*
|
||||
* This method is executed asynchronous.
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4.containers;
|
||||
@ -198,7 +198,7 @@ public class Data<DATATYPE extends Data<DATATYPE>> extends BasicContainer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.containers.Data#sort(Integer, Integer)
|
||||
* @see Data#sort(Integer, Integer)
|
||||
*/
|
||||
public DATATYPE sort(Integer start) {
|
||||
return (DATATYPE) sort(start, mLines.length);
|
||||
@ -296,7 +296,7 @@ public class Data<DATATYPE extends Data<DATATYPE>> extends BasicContainer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.containers.Data#assort(Integer, Integer)
|
||||
* @see Data#assort(Integer, Integer)
|
||||
*/
|
||||
public DATATYPE assort(Integer start) {
|
||||
return (DATATYPE) assort(mLines.length, start);
|
||||
@ -366,7 +366,7 @@ public class Data<DATATYPE extends Data<DATATYPE>> extends BasicContainer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.spazedog.lib.rootfw4.containers.Data#getLine(Integer, Boolean)
|
||||
* @see Data#getLine(Integer, Boolean)
|
||||
*/
|
||||
public String getLine(Integer aLineNumber) {
|
||||
return getLine(aLineNumber, false);
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4.utils;
|
||||
@ -159,15 +159,15 @@ public class Device {
|
||||
/**
|
||||
* Reboots the device into the recovery.<br /><br />
|
||||
*
|
||||
* This method first tries using the {@link android.os.PowerManager}, if that fails it fallbacks on using the reboot command from toolbox.<br /><br />
|
||||
* This method first tries using the {@link PowerManager}, if that fails it fallbacks on using the reboot command from toolbox.<br /><br />
|
||||
*
|
||||
* Note that using the {@link android.os.PowerManager} requires your app to optain the 'REBOOT' permission. If you don't want this, just parse NULL as {@link android.content.Context}
|
||||
* Note that using the {@link PowerManager} requires your app to optain the 'REBOOT' permission. If you don't want this, just parse NULL as {@link Context}
|
||||
* and the method will use the fallback. This however is more likely to fail, as many toolbox versions does not support the reboot command.
|
||||
* And since only the kernel can write to the CBC, we need a native caller to invoke this. So there is no fallback for missing toolbox support when it comes
|
||||
* to rebooting into the recovery.
|
||||
*
|
||||
* @param context
|
||||
* A {@link android.content.Context} or NULL to skip using the {@link android.os.PowerManager}
|
||||
* A {@link Context} or NULL to skip using the {@link PowerManager}
|
||||
*/
|
||||
public Boolean rebootRecovery(Context context) {
|
||||
if (context != null) {
|
||||
@ -230,7 +230,7 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Device.Process} instance
|
||||
* Get a new {@link Process} instance
|
||||
*
|
||||
* @param process
|
||||
* The name of the process
|
||||
@ -240,7 +240,7 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new {@link com.spazedog.lib.rootfw4.utils.Device.Process} instance
|
||||
* Get a new {@link Process} instance
|
||||
*
|
||||
* @param pid
|
||||
* The process id
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4.utils;
|
||||
@ -218,7 +218,7 @@ public class File {
|
||||
* size (on files), path to linked file (on links), permissions, group, user etc.
|
||||
*
|
||||
* @return
|
||||
* A new {@link com.spazedog.lib.rootfw4.utils.File.FileStat} object with all the file information
|
||||
* A new {@link FileStat} object with all the file information
|
||||
*/
|
||||
public FileStat getDetails() {
|
||||
synchronized (mLock) {
|
||||
@ -273,7 +273,7 @@ public class File {
|
||||
* The max amount of lines to return. This also excepts negative numbers. 0 equals all lines.
|
||||
*
|
||||
* @return
|
||||
* An array of {@link com.spazedog.lib.rootfw4.utils.File.FileStat} object
|
||||
* An array of {@link FileStat} object
|
||||
*/
|
||||
public FileStat[] getDetailedList(Integer maxLines) {
|
||||
synchronized (mLock) {
|
||||
@ -432,7 +432,7 @@ public class File {
|
||||
* Extract the content from the file and return it.
|
||||
*
|
||||
* @return
|
||||
* The entire file content wrapped in a {@link com.spazedog.lib.rootfw4.utils.File.FileData} object
|
||||
* The entire file content wrapped in a {@link FileData} object
|
||||
*/
|
||||
public FileData read() {
|
||||
synchronized (mLock) {
|
||||
@ -473,7 +473,7 @@ public class File {
|
||||
* Whether or not to return the non-matching lines instead
|
||||
*
|
||||
* @return
|
||||
* All of the matched or non-matched lines wrapped in a {@link com.spazedog.lib.rootfw4.utils.File.FileData} object
|
||||
* All of the matched or non-matched lines wrapped in a {@link FileData} object
|
||||
*/
|
||||
public FileData readMatch(final String match, final Boolean invert) {
|
||||
synchronized (mLock) {
|
||||
@ -589,9 +589,10 @@ public class File {
|
||||
for (String line : input) {
|
||||
String escapedInput = oPatternEscape.matcher(line).replaceAll("\\\\$1");
|
||||
Attempts attempts = mShell.createAttempts("echo '" + escapedInput + "' " + redirect + " '" + path + "' 2> /dev/null");
|
||||
|
||||
if (!(status = attempts.execute().wasSuccessful())) {
|
||||
break;
|
||||
|
||||
Result result = attempts.execute();
|
||||
if (result != null && !(status = result.wasSuccessful())) {
|
||||
break;
|
||||
}
|
||||
|
||||
redirect = ">>";
|
||||
@ -1092,6 +1093,8 @@ public class File {
|
||||
}
|
||||
|
||||
if (builder.length() > 0) {
|
||||
builder.append(" '" + getAbsolutePath() + "'");
|
||||
|
||||
Result result = mShell.createAttempts(builder.toString()).execute();
|
||||
|
||||
if (result != null && result.wasSuccessful()) {
|
||||
@ -1200,7 +1203,7 @@ public class File {
|
||||
* if it is not already mounted.
|
||||
*
|
||||
* @param context
|
||||
* A {@link android.content.Context} that can be used together with the Android <code>REBOOT</code> permission
|
||||
* A {@link Context} that can be used together with the Android <code>REBOOT</code> permission
|
||||
* to use the <code>PowerManager</code> to reboot into recovery. This can be set to NULL
|
||||
* if you want to just use the <code>toolbox reboot</code> command, however do note that not all
|
||||
* toolbox versions support this command.
|
||||
@ -1356,7 +1359,7 @@ public class File {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link com.spazedog.lib.rootfw4.utils.io.FileWriter} pointing at this file
|
||||
* Get a {@link FileWriter} pointing at this file
|
||||
*/
|
||||
public FileWriter getFileWriter() {
|
||||
if (isFile()) {
|
||||
@ -1372,7 +1375,7 @@ public class File {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link com.spazedog.lib.rootfw4.utils.io.FileReader} pointing at this file
|
||||
* Get a {@link FileReader} pointing at this file
|
||||
*/
|
||||
public FileReader getFileReader() {
|
||||
if (isFile()) {
|
||||
@ -1632,7 +1635,7 @@ public class File {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new {@link com.spazedog.lib.rootfw4.utils.File} object pointed at another file.
|
||||
* Open a new {@link File} object pointed at another file.
|
||||
*
|
||||
* @param fileName
|
||||
* The file to point at
|
||||
@ -1645,7 +1648,7 @@ public class File {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new {@link com.spazedog.lib.rootfw4.utils.File} object with the parent of this file.
|
||||
* Open a new {@link File} object with the parent of this file.
|
||||
*
|
||||
* @return
|
||||
* A new instance of this class representing the parent directory
|
||||
@ -1655,7 +1658,7 @@ public class File {
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is a link, this method will return a new {@link com.spazedog.lib.rootfw4.utils.File} object with the real path attached.
|
||||
* If this is a link, this method will return a new {@link File} object with the real path attached.
|
||||
*
|
||||
* @return
|
||||
* A new instance of this class representing the real path of a possible link
|
||||
|
@ -19,14 +19,6 @@
|
||||
|
||||
package com.spazedog.lib.rootfw4.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.spazedog.lib.rootfw4.Common;
|
||||
@ -35,6 +27,14 @@ import com.spazedog.lib.rootfw4.Shell.Result;
|
||||
import com.spazedog.lib.rootfw4.containers.BasicContainer;
|
||||
import com.spazedog.lib.rootfw4.utils.File.FileData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Filesystem {
|
||||
public static final String TAG = Common.TAG + ".Filesystem";
|
||||
|
||||
@ -162,7 +162,7 @@ public class Filesystem {
|
||||
* Or perhaps you need the original device of a specific mount location.
|
||||
*
|
||||
* @return
|
||||
* An array of {@link com.spazedog.lib.rootfw4.utils.Filesystem.MountStat} objects
|
||||
* An array of {@link MountStat} objects
|
||||
*/
|
||||
public MountStat[] getFsList() {
|
||||
synchronized(oFstabLock) {
|
||||
@ -235,7 +235,7 @@ public class Filesystem {
|
||||
* device path, mount location, file system type and mount options.
|
||||
*
|
||||
* @return
|
||||
* An array of {@link com.spazedog.lib.rootfw4.utils.Filesystem.MountStat} objects
|
||||
* An array of {@link MountStat} objects
|
||||
*/
|
||||
public MountStat[] getMountList() {
|
||||
FileData data = mShell.getFile("/proc/mounts").read();
|
||||
@ -264,7 +264,7 @@ public class Filesystem {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the {@link com.spazedog.lib.rootfw4.utils.Filesystem.Disk} class.
|
||||
* Get an instance of the {@link Disk} class.
|
||||
*
|
||||
* @param disk
|
||||
* The location to the disk, partition or folder
|
||||
@ -528,7 +528,7 @@ public class Filesystem {
|
||||
* only this method will just return the mount information for this specific device or mount location.
|
||||
*
|
||||
* @return
|
||||
* A single {@link com.spazedog.lib.rootfw4.utils.Filesystem.MountStat} object
|
||||
* A single {@link MountStat} object
|
||||
*/
|
||||
public MountStat getMountDetails() {
|
||||
MountStat[] list = getMountList();
|
||||
@ -563,7 +563,7 @@ public class Filesystem {
|
||||
* only this method will just return the mount information for this specific device or mount location.
|
||||
*
|
||||
* @return
|
||||
* A single {@link com.spazedog.lib.rootfw4.utils.Filesystem.MountStat} object
|
||||
* A single {@link MountStat} object
|
||||
*/
|
||||
public MountStat getFsDetails() {
|
||||
MountStat[] list = getFsList();
|
||||
@ -599,7 +599,7 @@ public class Filesystem {
|
||||
* information about the disk size, remaining bytes, used bytes and usage percentage.
|
||||
*
|
||||
* @return
|
||||
* A single {@link com.spazedog.lib.rootfw4.utils.Filesystem.DiskStat} object
|
||||
* A single {@link DiskStat} object
|
||||
*/
|
||||
public DiskStat getDiskDetails() {
|
||||
String[] commands = new String[]{"df -k '" + mFile.getAbsolutePath() + "'", "df '" + mFile.getAbsolutePath() + "'"};
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4.utils;
|
||||
@ -333,7 +333,7 @@ public class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new instance of {@link com.spazedog.lib.rootfw4.utils.Memory.Swap}
|
||||
* Get a new instance of {@link Swap}
|
||||
*
|
||||
* @param device
|
||||
* The Swap block device
|
||||
@ -343,7 +343,7 @@ public class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new instance of {@link com.spazedog.lib.rootfw4.utils.Memory.CompCache}
|
||||
* Get a new instance of {@link CompCache}
|
||||
*/
|
||||
public CompCache getCompCache() {
|
||||
return new CompCache(mShell);
|
||||
@ -386,7 +386,7 @@ public class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is an extension of the {@link com.spazedog.lib.rootfw4.utils.Memory} class.
|
||||
* This class is an extension of the {@link Memory} class.
|
||||
* This can be used to get information about-, and handle swap and CompCache/ZRam devices.
|
||||
*/
|
||||
public static class Swap extends Memory {
|
||||
@ -534,7 +534,7 @@ public class Memory {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an extension of the {@link com.spazedog.lib.rootfw4.utils.Memory.Swap} class. It's job is more CompCache/ZRam orientated.
|
||||
* This is an extension of the {@link Swap} class. It's job is more CompCache/ZRam orientated.
|
||||
* Unlike it's parent, this class can not only switch a CompCache/ZRam device on and off, it can also
|
||||
* locate the proper supported type and load it's kernel module if not already done during boot. <br /><br />
|
||||
*
|
||||
@ -582,11 +582,11 @@ public class Memory {
|
||||
/**
|
||||
* Enable this Swap device.<br /><br />
|
||||
*
|
||||
* This overwrites {@link com.spazedog.lib.rootfw4.utils.Memory.Swap#setSwapOn()} to enable to feature of
|
||||
* This overwrites {@link Swap#setSwapOn()} to enable to feature of
|
||||
* setting a cache size for the CompCache/ZRam. This method sets the size to 18% of the total device memory. <br /><br />
|
||||
*
|
||||
* If you are sure that CompCache/ZRam is loaded and the device has been setup with size and swap partition and you don't want to change this,
|
||||
* then use {@link com.spazedog.lib.rootfw4.utils.Memory.Swap#setSwapOn()} instead. But if nothing has been setup yet, it could fail as it does nothing else but try to activate the device as Swap.
|
||||
* then use {@link Swap#setSwapOn()} instead. But if nothing has been setup yet, it could fail as it does nothing else but try to activate the device as Swap.
|
||||
*
|
||||
* @see #setSwapOn(Integer)
|
||||
*/
|
||||
@ -657,7 +657,7 @@ public class Memory {
|
||||
/**
|
||||
* Disable this Swap device.<br /><br />
|
||||
*
|
||||
* This overwrites {@link com.spazedog.lib.rootfw4.utils.Memory.Swap#setSwapOff()} as this will also release the CompCache/ZRam from memory.
|
||||
* This overwrites {@link Swap#setSwapOff()} as this will also release the CompCache/ZRam from memory.
|
||||
*/
|
||||
@Override
|
||||
public Boolean setSwapOff() {
|
||||
|
@ -1,28 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Vlad Mihalachi
|
||||
* This file is part of the RootFW Project: https://github.com/spazedog/rootfw
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Bergløv
|
||||
*
|
||||
* This file is part of Turbo Editor.
|
||||
*
|
||||
* Turbo Editor is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* RootFW is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Turbo Editor is distributed in the hope that it will be useful,
|
||||
|
||||
* RootFW is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with RootFW. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.spazedog.lib.rootfw4.utils.io;
|
||||
|
||||
import com.spazedog.lib.rootfw4.Common;
|
||||
import com.spazedog.lib.rootfw4.Shell;
|
||||
import com.spazedog.lib.rootfw4.ShellStream;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -32,10 +29,14 @@ import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
import com.spazedog.lib.rootfw4.Common;
|
||||
import com.spazedog.lib.rootfw4.Shell;
|
||||
import com.spazedog.lib.rootfw4.ShellStream;
|
||||
|
||||
/**
|
||||
* This class allows you to open a file as root, if needed.
|
||||
* Files that are not protected will be handled by a regular {@link java.io.FileReader} while protected files
|
||||
* will use a shell streamer instead. Both of which will act as a normal reader that can be used together with other classes like {@link java.io.BufferedReader} and such. <br /><br />
|
||||
* will use a shell streamer instead. Both of which will act as a normal reader that can be used together with other classes like {@link BufferedReader} and such. <br /><br />
|
||||
*
|
||||
* Note that this should not be used for unending streams. This is only meant for regular files. If you need unending streams, like <code>/dev/input/event*</code>,
|
||||
* you should use {@link ShellStream} instead.
|
||||
@ -46,14 +47,14 @@ public class FileReader extends Reader {
|
||||
protected InputStreamReader mStream;
|
||||
|
||||
/**
|
||||
* Create a new {@link java.io.InputStreamReader}. However {@link com.spazedog.lib.rootfw4.utils.io.FileReader#FileReader(Shell, String)} is a better option.
|
||||
* Create a new {@link InputStreamReader}. However {@link FileReader#FileReader(Shell, String)} is a better option.
|
||||
*/
|
||||
public FileReader(String file) throws FileNotFoundException {
|
||||
this(null, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link java.io.InputStreamReader}. If <code>shell</code> is not <code>NULL</code>, then
|
||||
* Create a new {@link InputStreamReader}. If <code>shell</code> is not <code>NULL</code>, then
|
||||
* the best match for <code>cat</code> will be located whenever a SuperUser connection is needed. This will be the best
|
||||
* option for multiple environments.
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
*/
|
||||
private CustomDrawerLayout mDrawerLayout;
|
||||
private static GoodScrollView verticalScroll;
|
||||
private static GreatUri greatUri = new GreatUri(Uri.EMPTY, "", "", false);
|
||||
private static GreatUri greatUri = new GreatUri(Uri.EMPTY, "", "");
|
||||
private Editor mEditor;
|
||||
private HorizontalScrollView horizontalScroll;
|
||||
private static SearchResult searchResult;
|
||||
@ -332,13 +332,13 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
if (requestCode == SELECT_FILE_CODE) {
|
||||
|
||||
final Uri data = intent.getData();
|
||||
final GreatUri newUri = new GreatUri(data, AccessStorageApi.getPath(this, data), AccessStorageApi.getName(this, data), false);
|
||||
final GreatUri newUri = new GreatUri(data, AccessStorageApi.getPath(this, data), AccessStorageApi.getName(this, data));
|
||||
|
||||
newFileToOpen(newUri, "");
|
||||
} else {
|
||||
|
||||
final Uri data = intent.getData();
|
||||
final GreatUri newUri = new GreatUri(data, AccessStorageApi.getPath(this, data), AccessStorageApi.getName(this, data), false);
|
||||
final GreatUri newUri = new GreatUri(data, AccessStorageApi.getPath(this, data), AccessStorageApi.getName(this, data));
|
||||
|
||||
// grantUriPermission(getPackageName(), data, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
final int takeFlags = intent.getFlags()
|
||||
@ -757,11 +757,11 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
//newFileToOpen(new File(intent
|
||||
// .getData().getPath()), "");
|
||||
Uri uri = intent.getData();
|
||||
GreatUri newUri = new GreatUri(uri, AccessStorageApi.getPath(this, uri), AccessStorageApi.getName(this, uri), false);
|
||||
GreatUri newUri = new GreatUri(uri, AccessStorageApi.getPath(this, uri), AccessStorageApi.getName(this, uri));
|
||||
newFileToOpen(newUri, "");
|
||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
if ("text/plain".equals(type)) {
|
||||
newFileToOpen(new GreatUri(Uri.EMPTY, "", "", false), intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -843,7 +843,7 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
good = false;
|
||||
}
|
||||
if (good) {
|
||||
greatUris.addFirst(new GreatUri(particularUri, AccessStorageApi.getPath(this, particularUri), name, false));
|
||||
greatUris.addFirst(new GreatUri(particularUri, AccessStorageApi.getPath(this, particularUri), name));
|
||||
sb.append(savedPaths[i]).append(",");
|
||||
}
|
||||
}
|
||||
@ -914,10 +914,9 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
fileName = FilenameUtils.getName(filePath);
|
||||
fileExtension = FilenameUtils.getExtension(fileName).toLowerCase();
|
||||
|
||||
isRootRequired = !(new File(filePath).canRead());
|
||||
isRootRequired = !newUri.isReadable();
|
||||
// if we cannot read the file, root permission required
|
||||
if (isRootRequired) {
|
||||
newUri.setRootRequired(true);
|
||||
readUri(newUri.getUri(), filePath, true);
|
||||
}
|
||||
// if we can read the file associated with the uri
|
||||
@ -987,6 +986,8 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
fileText = stringBuilder.toString();
|
||||
}
|
||||
|
||||
if (isRootRequired)
|
||||
RootFW.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1160,7 +1161,7 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
}
|
||||
|
||||
void closedTheFile() {
|
||||
arrayAdapter.selectPosition(new GreatUri(Uri.EMPTY, "", "", false));
|
||||
arrayAdapter.selectPosition(new GreatUri(Uri.EMPTY, "", ""));
|
||||
}
|
||||
//endregion
|
||||
|
||||
@ -1197,7 +1198,7 @@ public abstract class MainActivity extends ActionBarActivity implements IHomeAct
|
||||
//intent.putExtra(Intent.EXTRA_TITLE, ".txt");
|
||||
startActivityForResult(intent, CREATE_REQUEST_CODE);
|
||||
} else {
|
||||
newFileToOpen(new GreatUri(Uri.EMPTY, "", "", false), "");
|
||||
newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class AdapterDrawer extends
|
||||
private final LayoutInflater inflater;
|
||||
// List of file details
|
||||
private final LinkedList<GreatUri> greatUris;
|
||||
private GreatUri selectedGreatUri = new GreatUri(Uri.EMPTY, "", "", false);
|
||||
private GreatUri selectedGreatUri = new GreatUri(Uri.EMPTY, "", "");
|
||||
|
||||
public AdapterDrawer(Context context,
|
||||
LinkedList<GreatUri> greatUris,
|
||||
@ -75,7 +75,7 @@ public class AdapterDrawer extends
|
||||
boolean closeOpenedFile = selectedGreatUri.getUri().equals(greatUri.getUri());
|
||||
callbacks.CancelItem(position, closeOpenedFile);
|
||||
if (closeOpenedFile)
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", "", false));
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", ""));
|
||||
|
||||
}
|
||||
});
|
||||
@ -97,7 +97,7 @@ public class AdapterDrawer extends
|
||||
boolean closeOpenedFile = selectedGreatUri.getUri().equals(greatUri.getUri());
|
||||
callbacks.CancelItem(position, closeOpenedFile);
|
||||
if (closeOpenedFile)
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", "", false));
|
||||
selectPosition(new GreatUri(Uri.EMPTY, "", ""));
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -114,7 +114,7 @@ public class NewFileDetailsDialog extends DialogFragment {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
|
||||
final GreatUri newUri = new GreatUri(Uri.fromFile(file), file.getAbsolutePath(), file.getName(), false);
|
||||
final GreatUri newUri = new GreatUri(Uri.fromFile(file), file.getAbsolutePath(), file.getName());
|
||||
|
||||
new SaveFileTask((MainActivity) getActivity(), newUri, fileText, fileEncoding, new SaveFileTask.SaveFileInterface() {
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ public class SaveFileDialog extends DialogFragment {
|
||||
this.text = text;
|
||||
this.encoding = encoding;
|
||||
this.openNewFileAfter = false;
|
||||
this.newUri = new GreatUri(Uri.EMPTY, "", "", false);
|
||||
this.newUri = new GreatUri(Uri.EMPTY, "", "");
|
||||
}
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
|
@ -27,6 +27,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.spazedog.lib.rootfw4.RootFW;
|
||||
import com.spazedog.lib.rootfw4.utils.File;
|
||||
import com.spazedog.lib.rootfw4.utils.Filesystem;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@ -75,14 +76,7 @@ public class SaveFileTask extends AsyncTask<Void, Void, Void> {
|
||||
if (TextUtils.isEmpty(filePath)) {
|
||||
writeUri(uri.getUri(), newContent, encoding);
|
||||
} else {
|
||||
if (uri.isRootRequired()) {
|
||||
if (RootFW.connect()) {
|
||||
File file = RootFW.getFile(filePath);
|
||||
file.write(newContent);
|
||||
}
|
||||
}
|
||||
// if we can read the file associated with the uri
|
||||
else {
|
||||
if (uri.isWritable()) {
|
||||
if (Device.hasKitKatApi())
|
||||
writeUri(uri.getUri(), newContent, encoding);
|
||||
else {
|
||||
@ -91,6 +85,21 @@ public class SaveFileTask extends AsyncTask<Void, Void, Void> {
|
||||
encoding);
|
||||
}
|
||||
}
|
||||
// if we can read the file associated with the uri
|
||||
else {
|
||||
|
||||
if (RootFW.connect()) {
|
||||
Filesystem.Disk systemPart = RootFW.getDisk(uri.getParentFolder());
|
||||
systemPart.mount(new String[]{"rw"});
|
||||
|
||||
File file = RootFW.getFile(uri.getFilePath());
|
||||
file.write(newContent);
|
||||
|
||||
RootFW.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message = positiveMessage;
|
||||
|
@ -33,13 +33,11 @@ public class GreatUri {
|
||||
private Uri uri;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private boolean isRootRequired;
|
||||
|
||||
public GreatUri(Uri uri, String filePath, String fileName, boolean isRootRequired) {
|
||||
public GreatUri(Uri uri, String filePath, String fileName) {
|
||||
this.uri = uri;
|
||||
this.filePath = filePath;
|
||||
this.fileName = fileName;
|
||||
this.isRootRequired = isRootRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,11 +90,11 @@ public class GreatUri {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public boolean isRootRequired() {
|
||||
return isRootRequired;
|
||||
public boolean isReadable() {
|
||||
return new File(getFilePath()).canRead();
|
||||
}
|
||||
|
||||
public void setRootRequired(boolean isRootRequired) {
|
||||
this.isRootRequired = isRootRequired;
|
||||
public boolean isWritable() {
|
||||
return new File(getFilePath()).canWrite();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user