qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請(qǐng)?jiān)L問 http://qaseven.github.io/

          Android數(shù)據(jù)庫(kù)安全permission

           android是基于linux操作系統(tǒng),linux本身就提供了強(qiáng)大的安全機(jī)制。
            1. 應(yīng)用程序沙箱,將你的代碼、數(shù)據(jù)與其他app隔離
            2. 應(yīng)用框架層提供了“魯棒”的加密、權(quán)限以及安全的進(jìn)程間通信機(jī)制
            3. ASLR, NX, ProPolice, safe_iop, OpenBSD dlmalloc, OpenBSD calloc, and Linux mmap_min_addr 來處理共享內(nèi)存的風(fēng)險(xiǎn)
            這片文章主要講的是大家不要亂用這個(gè)權(quán)限相關(guān)的東西
            使用權(quán)限:
            如果你的應(yīng)用程序可以不使用任何權(quán)限當(dāng)然是最好的,曾經(jīng)安裝一個(gè)單機(jī)游戲,看到不需要任何權(quán)限的的時(shí)候就感覺很舒服。
            舉例:做應(yīng)用過程中需要建立一個(gè)唯一標(biāo)識(shí)。有很多種方法,主要是通過訪問設(shè)備信息,有獲得imei的 有獲得wifi的mac地址的等等,這就需要程序中獲得電話操作(imei)或者是wifi操作的權(quán)限。比如寫了一個(gè)應(yīng)用,當(dāng)用戶看到你需要訪問電話的權(quán)限的時(shí)候就會(huì)感覺很奇怪了,我安裝一個(gè)游戲?yàn)樯缎璋央娫挼臋?quán)限啊?其實(shí)只是為了獲得一個(gè)唯一標(biāo)識(shí)。
            定義權(quán)限:
          private void insertGroup() {
          // Internal storage where the DexClassLoader writes the optimized dex file to.
          final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE);
          // Initialize the class loader with the secondary dex file.
          DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
          optimizedDexOutputPath.getAbsolutePath(),
          null,
          getClassLoader());
          Class libProviderClazz = null;
          try {
          // Load the library class from the class loader.
          // 載入從網(wǎng)絡(luò)上下載的類的全類名
          libProviderClazz =
          cl.loadClass("com.kunpeng.pim.GroupDao");
          // Cast the return object to the library interface so that the
          // caller can directly invoke methods in the interface.
          // Alternatively, the caller can invoke methods through reflection,
          // which is more verbose and slow.
          Class<?>[] argTypes = {Context.class};
          Constructor<?> constructor = libProviderClazz.getConstructor(argTypes);
          IGroupDao lib = (IGroupDao) constructor.newInstance(this);
          // Display the toast!
          lib.addGroup("test");
          } catch (Exception exception) {
          // Handle exception gracefully here.
          exception.printStackTrace();
          }

          posted on 2013-11-18 13:42 順其自然EVO 閱讀(264) 評(píng)論(0)  編輯  收藏 所屬分類: linuxandroid

          <2013年11月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 阿克陶县| 资溪县| 饶河县| 延吉市| 连江县| 哈巴河县| 齐齐哈尔市| 福州市| 谷城县| 新津县| 六枝特区| 突泉县| 溧水县| 五莲县| 东乌珠穆沁旗| 揭东县| 宿州市| 和平区| 沐川县| 九江县| 基隆市| 贵州省| 枣阳市| 大宁县| 新丰县| 新晃| 南靖县| 牟定县| 集贤县| 浦县| 沙雅县| 栖霞市| 广东省| 桃园县| 平遥县| 永年县| 漳平市| 调兵山市| 嘉善县| 古交市| 琼中|