레이블이 SD인 게시물을 표시합니다. 모든 게시물 표시
레이블이 SD인 게시물을 표시합니다. 모든 게시물 표시

2017년 2월 28일 화요일

How to write to external storage on odroid(marshmallow android 6.0.1).

You maybe install utorrent app, but you can't download torrent file in external storage installed android 6.0.1(marshmallow).


Edit packages.xml.

$ su
# vi /data/system/packages.xml

<package name="com.utorrent.client" codePath="/data/app/com.utorrent.client-1" nativeLibraryPath="/data/app/com.utorrent.client-1/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097092" privateFlags="0" ft="15a648b6388" it="15a648b6f1f" ut="15a648b6f1f" version="245" userId="10069" installer="com.android.vending">
        ...
        <perms>
            ...
            <item name="android.permission.ACCESS_WIFI_STATE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />
        </perms>


or hacking frameworks.


diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 647c17b..1ec1fe7 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -22,6 +22,7 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.WRITE_MEDIA_STORAGE;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
@@ -1935,6 +1936,8 @@ final class Settings {
             return;
         }

+        boolean isMediaStoragePermission = false;
+
         serializer.startTag(null, TAG_PERMISSIONS);

         for (PermissionState permissionState : permissionStates) {
@@ -1943,6 +1946,19 @@ final class Settings {
             serializer.attribute(null, ATTR_GRANTED, String.valueOf(permissionState.isGranted()));
             serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(permissionState.getFlags()));
             serializer.endTag(null, TAG_ITEM);
+
+            if (!isMediaStoragePermission
+                    && permissionState.getName().equals(WRITE_MEDIA_STORAGE)) {
+                isMediaStoragePermission = true;
+            }
+        }
+
+        if (!isMediaStoragePermission) {
+            serializer.startTag(null, TAG_ITEM);
+            serializer.attribute(null, ATTR_NAME, WRITE_MEDIA_STORAGE);
+            serializer.attribute(null, ATTR_GRANTED, "true");
+            serializer.attribute(null, ATTR_FLAGS, Integer.toHexString(0));
+            serializer.endTag(null, TAG_ITEM);
         }

         serializer.endTag(null, TAG_PERMISSIONS);

Automatically permission string is inserted in packages.xml.


After install app from Market you must reboot system.


2011년 10월 1일 토요일

android에서 app을 SD에 설치하기 위해 kernel features.


android 2.2 froyo 버전 부터 app을 SD Card에 설치 할 수 있습니다.

2.6.35 kernel 이상부터 아래 feature를 켜 주면 SD Card로 옮기기가 가능합니다.

CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_CRYPT=y

CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y