Hi, all,

   My device porting is almost complete and now I try to pass CTS test.

   There are some strange issue that I do not know how to solve.

    1. I know for JellyBean, the READ_LOGS permission are restricted to 
system. But I still can read output from logcat in my device.
 
        PackageManager pm = getPackageManager();
        pm.checkPermission(Manifest.permission.READ_LOGS, getPackageName()) 
== PackageManager.PERMISSION_GRANTED)) 

        the above code return false. Means my test apk does not contain 
READ_LOGS permission. But I can still get log from logcat by the following 
code:
     
        logcatProc = Runtime.getRuntime().exec(new String[]
                    {"logcat", "-d", "ActivityManager:* *:S" });

            reader = new BufferedReader(new 
InputStreamReader(logcatProc.getInputStream()));

            int lineCt = 0;
            String line;
            while ((line = reader.readLine()) != null) {
                if (!line.startsWith("--------- beginning of /dev/log")) {
                    lineCt++;
                }
            }

           lineCt is not zero. I have checked 
my  frameworks/base/core/res/AndroidManifest.xml

           <permission android:name="android.permission.READ_LOGS"         
                                                                            
              
                              
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"       
                                                                           
                              
android:protectionLevel="signature|system|development"                     
                                                                           
                              android:label="@string/permlab_readLogs"     
                                                                            
                             
                              
android:description="@string/permdesc_readLogs" />                         
                                                                           

            Seems not unusually. I also check logcat source code but does 
not find any thing check the permission. 

       2.  InetAddress.getByName("www.yahoo.com"); need throw security 
exception. 
            But it can pass on my device even the apk does not grant 

            android.permission.INTERNET and 

       Code base is android 4.2.1, any one have hint?  Just don't know how 
to debug such kind of issues.

       
                                                               

-- 
-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to