Package Play

Package Play shows the user all installed packages on the mobile device. 能看到装了那些应用

 This helps the user in the following ways:

Easy way to start exported Activities 能直接启动activity

Shows defined and used permissions 查看权限

Shows activities, services, receivers, providers and instrumentation, their export and permission status  查看组件导出与否、权限等

Switches to Manifest Explorer or the Setting’sapplications view of the application.

               Map<String, PackageInfo> packages = new HashMap<String,PackageInfo>();

               PackageManager pm =getPackageManager();

               List<PackageInfo> l =pm.getInstalledPackages(GET_MINIMAL);

               mPkgs = (ListView)findViewById(R.id.package_list);

 

               for (PackageInfo pi : l)

                       packages.put(pi.packageName,pi);

 

public voidonItemClick(AdapterView<?> arg0, View v, int pos,

                                      longrowId) {

                               Intent i = newIntent();

                               ListView lv =(ListView) arg0;

                               i.setComponent(newComponentName(

                                              "com.isecpartners.android.packageplay",

                                              "com.isecpartners.android.packageplay.ViewPackage"));

                               ArrayList<String>l = new ArrayList<String>();

                               String name =(String) lv.getItemAtPosition(pos);

                               if (null != name&& name.equals("All")) {

                                      l =(ArrayList<String>) mPackageNames.clone();

                                      // removethe "All" dummy entry from the list

                                      l.remove(0);

                               } else

                                      l.add(name);

 

                               i.putExtra("pkgs",l);

 

                               startActivity(i);

                       }

         *Looks at the spinner for the currently selected Activity, then starts it.

         */

        public void startCurrentlySelected() {

               Intent i = newIntent(Intent.ACTION_MAIN);

               i.setComponent(newComponentName(mPkgName, mActivities

                               .getSelectedItem().toString()));

               startActivity(i);

        }

 

               mSystemViewButton.setOnClickListener(newOnClickListener() {

                       public void onClick(Viewv) {

                               Intent i = newIntent(Intent.ACTION_VIEW);

                               i.setClassName("com.android.settings",

                                              "com.android.settings.InstalledAppDetails");

                               i.putExtra("com.android.settings.ApplicationPkgName",mPkgName);

                               startActivity(i);

                       }

               });

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值