diff --git a/Settings/res/values-zh-rCN/strings.xml b/Settings/res/values-zh-rCN/strings.xml
index f7932cf7..190d451c 100755
--- a/Settings/res/values-zh-rCN/strings.xml
+++ b/Settings/res/values-zh-rCN/strings.xml
@@ -246,7 +246,7 @@
     <string name="title_ok" msgid="1021329453788761592">"确定"</string>
     <string name="title_cancel" msgid="4846143417666038604">"取消"</string>
     <string name="storage_title" msgid="2132026108559493394">"存储空间"</string>
-    <string name="storage_available" msgid="1241005580092138871">"可用存储空间"</string>
+    <string name="storage_available" msgid="1241005580092138871">"其他数据"</string>
     <string name="storage_size" msgid="8958530823208352781">"总存储空间:<xliff:g id="TOTAL_SPACE">%1$s</xliff:g>"</string>
     <string name="storage_calculating_size" msgid="2644732407412520565">"正在计算..."</string>
     <string name="storage_apps_usage" msgid="4366049071039081219">"应用"</string>
@@ -661,7 +661,7 @@
     <string name="change_setting" msgid="2047402388786162246">"更改"</string>
     <string name="keep_settings" msgid="6798327196645732517">"不要更改"</string>
     <string name="apps_permissions" msgid="1283592091618660965">"权限"</string>
-    <string name="device_apps_permissions" msgid="2966387603529725982">"应用访问授权"</string>
+    <string name="device_apps_permissions" msgid="2966387603529725982">"应用访问权限"</string>
     <string name="device_apps_install">应用安装</string>
     <string name="app_permissions_group_summary" msgid="7906834786705287901">"已授权 <xliff:g id="COUNT_0">%d</xliff:g> 个应用(共 <xliff:g id="COUNT_1">%d</xliff:g> 个)"</string>
     <string name="bluetooth_permission_request" msgid="6649813878683015301">"蓝牙权限请求"</string>
diff --git a/Settings/res/xml/main_prefs.xml b/Settings/res/xml/main_prefs.xml
index 48bba4dd..2101a41f 100755
--- a/Settings/res/xml/main_prefs.xml
+++ b/Settings/res/xml/main_prefs.xml
@@ -175,6 +175,7 @@
                 android:action="com.google.android.gsf.notouch.USAGE_AND_DIAGNOSTICS_SETTING" />
         </Preference>
     </PreferenceCategory>
+<!--
     <PreferenceCategory
         android:key="accounts"
         android:title="@string/accounts_category_title">
@@ -187,5 +188,5 @@
                 android:targetPackage="com.google.android.gsf.pano" />
         </Preference>
     </PreferenceCategory>
-
+-->
 </PreferenceScreen>
diff --git a/Settings/src/com/android/tv/settings/MainFragment.java b/Settings/src/com/android/tv/settings/MainFragment.java
index 3ea1c22b..42be4c49 100755
--- a/Settings/src/com/android/tv/settings/MainFragment.java
+++ b/Settings/src/com/android/tv/settings/MainFragment.java
@@ -264,7 +264,7 @@ public class MainFragment extends LeanbackPreferenceFragment {
                 touchedAccounts.add(key);
                 preference.setKey(key);
 
-                mAccountsGroup.addPreference(preference);
+            //    mAccountsGroup.addPreference(preference);
             }
         }
 
@@ -291,8 +291,9 @@ public class MainFragment extends LeanbackPreferenceFragment {
                         allowableAccountTypes.toArray(new String[allowableAccountTypes.size()]));
 
                 // If there are available account types, show the "add account" button.
-                addAccountPref.setVisible(!allowableAccountTypes.isEmpty());
-                addAccountPref.setIntent(i);
+              //  addAccountPref.setVisible(!allowableAccountTypes.isEmpty());
+                  addAccountPref.setVisible(false);
+         addAccountPref.setIntent(i);
             }
         }
     }
diff --git a/Settings/src/com/android/tv/settings/bluetooth/BluetoothDevicePreference.java b/Settings/src/com/android/tv/settings/bluetooth/BluetoothDevicePreference.java
index b8e3c0ac..544c799c 100755
--- a/Settings/src/com/android/tv/settings/bluetooth/BluetoothDevicePreference.java
+++ b/Settings/src/com/android/tv/settings/bluetooth/BluetoothDevicePreference.java
@@ -15,10 +15,11 @@
  */
 
 package com.android.tv.settings.bluetooth;
-
+import java.io.IOException;
 import android.app.AlertDialog;
 import android.bluetooth.BluetoothClass;
 import android.bluetooth.BluetoothDevice;
+import android.content.Intent;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.res.Resources;
@@ -34,17 +35,31 @@ import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.View.OnLongClickListener;
 import android.widget.ImageView;
-
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
 import com.android.tv.settings.R;
 import com.android.tv.settings.search.Index;
 import com.android.tv.settings.search.SearchIndexableRaw;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.bluetooth.HidProfile;
 import com.android.settingslib.bluetooth.LocalBluetoothProfile;
-
+import android.bluetooth.BluetoothGatt;
 import java.util.List;
-
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.StringBuilder;
+import android.util.Log;
 import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.FileOutputStream;
+import android.os.SystemProperties;
+import android.os.SystemService;
+import java.io.File;
 
 /**
  * BluetoothDevicePreference is the preference type used to display each remote
@@ -64,6 +79,7 @@ public final class BluetoothDevicePreference extends Preference implements
 
     private String contentDescription = null;
 
+    private static boolean mHaveRoot = false;
     /* Talk-back descriptions for various BT icons */
     Resources r = getContext().getResources();
     public final String COMPUTER =  r.getString(R.string.bluetooth_talkback_computer);
@@ -75,6 +91,8 @@ public final class BluetoothDevicePreference extends Preference implements
     public final String HEADPHONE = r.getString(R.string.bluetooth_talkback_headphone);
     public final String BLUETOOTH = r.getString(R.string.bluetooth_talkback_bluetooth);
 
+
+
     public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) {
         super(context);
 
@@ -100,6 +118,101 @@ public final class BluetoothDevicePreference extends Preference implements
         onDeviceAttributesChanged();
     }
 
+   /**
+     *   判断机器Android是否已经root,即是否获取root权限
+     */
+    public static boolean haveRoot() {
+        if (!mHaveRoot) {
+            int ret = execRootCmdSilent("echo test"); // 通过执行测试命令来检测
+            if (ret != -1) {
+                Log.i(TAG, "have root!");
+                mHaveRoot = true;
+            } else {
+                Log.i(TAG, "not root!");
+            }
+        } else {
+            Log.i(TAG, "mHaveRoot = true, have root!");
+        }
+        return mHaveRoot;
+    }
+
+    /**
+         * 执行命令并且输出结果
+         */
+    public static String execRootCmd(String cmd) {
+        String result = "";
+        DataOutputStream dos = null;
+        DataInputStream dis = null;
+
+        try {
+            Process p = Runtime.getRuntime().exec("su");// 经过Root处理的android系统即有su命令
+            dos = new DataOutputStream(p.getOutputStream());
+            dis = new DataInputStream(p.getInputStream());
+
+            Log.i(TAG, cmd);
+            dos.writeBytes(cmd + "\n");
+            dos.flush();
+            dos.writeBytes("exit\n");
+            dos.flush();
+            String line = null;
+            while ((line = dis.readLine()) != null) {
+                Log.d("result", line);
+                result += line;
+            }
+            p.waitFor();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (dos != null) {
+                try {
+                    dos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (dis != null) {
+                try {
+                    dis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+         * 执行命令但不关注结果输出
+         */
+    public static int execRootCmdSilent(String cmd) {
+        int result = -1;
+        DataOutputStream dos = null;
+
+        try {
+            Process p = Runtime.getRuntime().exec("su");
+            dos = new DataOutputStream(p.getOutputStream());
+
+            Log.i(TAG, cmd);
+            dos.writeBytes(cmd + "\n");
+            dos.flush();
+            dos.writeBytes("exit\n");
+            dos.flush();
+            p.waitFor();
+            result = p.exitValue();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (dos != null) {
+                try {
+                    dos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return result;
+    }
+
     void rebind() {
         notifyChanged();
     }
@@ -225,11 +338,45 @@ public final class BluetoothDevicePreference extends Preference implements
             askDisconnect();
         } else if (bondState == BluetoothDevice.BOND_BONDED) {
             mCachedDevice.connect(true);
+//        SystemProperties.set("persist.sys.bt_switch", "1"); 
         } else if (bondState == BluetoothDevice.BOND_NONE) {
             pair();
         }
     }
 

+ private void updateLEDState(String path, String cmd) {
+  Log.i(TAG, "-------------cmd=" + cmd + "------------------");
+  File f = new File(path);
+  if (!f.exists()) {
+   return;
+  }
+  OutputStream output = null;
+  OutputStreamWriter outputWrite = null;
+  PrintWriter print = null;
+  StringBuffer strbuf = new StringBuffer("");
+  strbuf.append(cmd);
+  try {
+   output = new FileOutputStream(f);
+   outputWrite = new OutputStreamWriter(output);
+   print = new PrintWriter(outputWrite);
+   print.print(strbuf.toString());
+   print.flush();
+  } catch (Exception e) {
+   e.printStackTrace();
+  } finally {
+   try {
+    if (output != null) {
+     output.close();
+    }
+    if (print != null) {
+     print.close();
+    }
+   } catch (Exception e) {
+    e.printStackTrace();
+   }
+  }
+ }
     // Show disconnect confirmation dialog for a device.
     private void askDisconnect() {
         Context context = getContext();
@@ -243,13 +390,110 @@ public final class BluetoothDevicePreference extends Preference implements
         DialogInterface.OnClickListener disconnectListener = new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) {
                 mCachedDevice.disconnect();
-            }
+        mCachedDevice.unpair();
+
+
+//        updateLEDState("/sys/class/rfkill/rfkill0/state","0");
+//        updateLEDState("/sys/class/rfkill/rfkill0/state","1");
+
+//        SystemProperties.set("persist.sys.bt_switch", "0");
+//        SystemProperties.set("persist.sys.bt_switch", "1");
+
+//    deletecamerafile();  // System.err: java.io.IOException: Cannot run program "adb": error=13, Permission denied
+
+//        execShell("echo 0 > /sys/class/rfkill/rfkill0/state");
+//        execShell("echo 1 > /sys/class/rfkill/rfkill0/state");
+
+//    execRootCmd("echo 0 > /sys/class/rfkill/rfkill0/state");
+//    execRootCmd("echo 1 > /sys/class/rfkill/rfkill0/state");
+/*
+    String cmd = "cat /system/usr/defApps.json";
+
+    System.out.print(cmd);    
+   try {
+   
+        Runtime.getRuntime().exec(cmd);
+}
+ catch (IOException e) {
+   e.printStackTrace();
+
+   }
+
+
+
+
+        mDeviceGatt = mCachedDevice.connectGatt(getActivity(), true, new GattBatteryCallbacks());
+
+        mDeviceGatt.disconnect();
+
+         Intent intent = new Intent();
+         intent.setAction("com.aispeech.tvui.action.BLE_RC");
+         intent.setComponent(new ComponentName("com.aispeech.tvui", "com.aispeech.tvui.recorder.receiver.ExternalCommandReceiver"));
+         intent.putExtra("switch", "disconnect");
+         context.sendBroadcast(intent);
+*/  
+          }
         };
 
         mDisconnectDialog = BluetoothUtils.showDisconnectDialog(context,
                 mDisconnectDialog, disconnectListener, title, Html.fromHtml(message));
     }
 
+/*
+    public void deletecamerafile() {
+        try {
+             Process process = Runtime.getRuntime().exec("adb root & adb remount & adb shell");
+             BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
+             process.getOutputStream().write("echo 0 > /sys/class/rfkill/rfkill0/state\r\n".getBytes());
+             process.getOutputStream().write("echo 1 > /sys/class/rfkill/rfkill0/state \r\n".getBytes());
+             process.getOutputStream().flush(); //刷新流
+             Thread.sleep(2000);
+             input.close();
+             process.destroy();
+             System.out.println("手机中的照片清除完毕...");
+        } catch (IOException e) {
+            // TODO: handle exception
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+    }
+*/
+
+
+public String execShell(String cmd) {
+        StringBuilder s = new StringBuilder();
+        try {
+            //su 为root用户   sh 为普通用户
+            //java.lang.Process process = Runtime.getRuntime().exec("sh");
+            //OutputStream outputStream = process.getOutputStream();
+            //DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
+            //写命令
+            //dataOutputStream.writeBytes(cmd);
+            //提交命令
+            //dataOutputStream.flush();
+            java.lang.Process process = Runtime.getRuntime().exec(cmd);
+            InputStream inputStream = process.getInputStream();
+            BufferedReader bufferedReader = new BufferedReader(
+                    new InputStreamReader(inputStream));
+            try {
+                process.waitFor();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            String line = null;
+            while ((line = bufferedReader.readLine()) != null) {
+                s.append(line).append("\n");
+            }
+            inputStream.close();
+            bufferedReader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return s.toString();
+    }
     private void pair() {
         if (!mCachedDevice.startPairing()) {
             BluetoothUtils.showError(getContext(), mCachedDevice.getName(),
diff --git a/Settings/src/com/android/tv/settings/device/StorageResetFragment.java b/Settings/src/com/android/tv/settings/device/StorageResetFragment.java
index 942c4357..2ac55e0f 100644
--- a/Settings/src/com/android/tv/settings/device/StorageResetFragment.java
+++ b/Settings/src/com/android/tv/settings/device/StorageResetFragment.java
@@ -233,17 +233,77 @@ public class StorageResetFragment extends LeanbackPreferenceFragment {
                     .getBestVolumeDescription(volumeInfo);
             setTitle(description);
             if (volumeInfo.isMountedReadable()) {
-                setSummary(getSizeString(volumeInfo));
-                setFragment(StorageFragment.class.getName());
+    //    if((volumeInfo.getPath().getAbsolutePath().indexOf("/data") == 0) || (volumeInfo.getPath().getAbsolutePath().indexOf("/storage/emulated/0") == 0))
+          //      {
+             setSummary(getTfSizeString(volumeInfo));
+    //    }
+          //      {
+        
+    //     setSummary(getSizeString(volumeInfo));
+    //    }
+        
+        setFragment(StorageFragment.class.getName());
                 StorageFragment.prepareArgs(getExtras(), volumeInfo);
             } else {
                 setSummary(context.getString(R.string.storage_unmount_success, description));
             }
         }
 

+ private String getTfSizeString(VolumeInfo vol) {
+     final File path = vol.getPath();
+                 String abs = path.getAbsolutePath();
+     Log.d(TAG, "tfabs Skipping volume " + abs);
+
+     if (vol.isMountedReadable() && path != null) {
+           long totalsize = path.getTotalSpace();
+                         
+                         if (!abs.contains("storage")) {
+            if (totalsize > 64L*1024*1024*1024) {
+                totalsize = 128L*1024*1024*1024;
+            } else if (totalsize > 32L*1024*1024*1024) {
+                    totalsize = 64L*1024*1024*1024;
+                } else if (totalsize > 16L*1024*1024*1024) {
+                        totalsize = 32L*1024*1024*1024;
+                    } else if (totalsize > 8L*1024*1024*1024) {
+                        totalsize = 16L*1024*1024*1024;
+                    } else if (totalsize > 4L*1024*1024*1024) {
+                        totalsize = 8L*1024*1024*1024;
+                    }    
+                        
+                         long fake_rom_size = android.os.SystemProperties.getLong("ro.boot.fake_rom_size", 0);
+                       if(fake_rom_size != 0) {
+                               totalsize = fake_rom_size*1024*1024*1024;
+                       }
+}
+else
+{
+  if (totalsize > 64L*1024*1024*1024) {
+      totalsize = 128L*1024*1024*1024;
+  } else if (totalsize > 32L*1024*1024*1024) {
+          totalsize = 64L*1024*1024*1024;
+      } else if (totalsize > 16L*1024*1024*1024) {
+              totalsize = 32L*1024*1024*1024;
+          } else if (totalsize > 8L*1024*1024*1024) {
+              totalsize = 16L*1024*1024*1024;
+          } else if (totalsize > 4L*1024*1024*1024) {
+              totalsize = 8L*1024*1024*1024;
+          }
+
+
+}
+                         return String.format(getContext().getString(R.string.storage_size),
+                 StoragePreference.formatSize(getContext(), totalsize));
+     } else {
+         return null;
+     }
+ }
+
         private String getSizeString(VolumeInfo vol) {
             final File path = vol.getPath();
             String abs = path.getAbsolutePath();
+         Log.d(TAG, "abs Skipping volume " + abs);
+
             if (vol.isMountedReadable() && path != null) {
                   long totalsize = path.getTotalSpace();
 
@@ -260,10 +320,10 @@ public class StorageResetFragment extends LeanbackPreferenceFragment {
                        totalsize = 8L*1024*1024*1024;
                    }
                 }
-                long fake_rom_size = android.os.SystemProperties.getLong("ro.boot.fake_rom_size", 0);
-                if(fake_rom_size != 0) {
-                    totalsize = fake_rom_size*1024*1024*1024;
-                }
+                //long fake_rom_size = android.os.SystemProperties.getLong("ro.boot.fake_rom_size", 0);
+            //    if(fake_rom_size != 0) {
+            //        totalsize = fake_rom_size*1024*1024*1024;
+            //    }
                 return String.format(getContext().getString(R.string.storage_size),
                         StoragePreference.formatSize(getContext(), totalsize));
             } else {
diff --git a/Settings/src/com/android/tv/settings/device/font/FontFragment.java b/Settings/src/com/android/tv/settings/device/font/FontFragment.java
index f53dc713..d2adacec 100644
--- a/Settings/src/com/android/tv/settings/device/font/FontFragment.java
+++ b/Settings/src/com/android/tv/settings/device/font/FontFragment.java
@@ -103,7 +103,7 @@ public class FontFragment extends LeanbackPreferenceFragment {
     }
 
     private float getFontSize() {
-        return Settings.System.getFloat(mResolver, Settings.System.FONT_SCALE , 1.0f);
+        return Settings.System.getFloat(mResolver, Settings.System.FONT_SCALE , 1.13f);
     }
 
     private void setFontSize(float val) {
 

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐