Home | History | Annotate | Download | only in articles
      1 page.title= 
      2 page.keywords=preview, sdk,  
      3 page.tags=androidn
      4 page.image=images/cards/card-nyc_2x.jpg
      5 
      6 @jd:body
      7 
      8 <div id="tb-wrapper">
      9 <div id="tb">
     10   <h2>  </h2>
     11   <ol>
     12     <li><a href="#run">      </a></li>
     13     <li><a href="#access">   </a></li>
     14     <li><a href="#notification">    </a></li>
     15     <li><a href="#migrating">  </a></li>
     16     <li><a href="#testing">   </a></li>
     17   </ol>
     18 </div>
     19 </div>
     20 
     21 <p>    <i>   </i>   Android N 
     22  
     23   .            .</p>
     24 
     25 <ul>
     26 <li><i>   :</i>  ,     
     27   .</li>
     28 <li><i>  :</i>       
     29      .</li>
     30 </ul>
     31 
     32 <p>       .
     33      ,
     34          .       
     35       .</p>
     36 
     37 <ul>
     38 <li>      
     39 .</li>
     40 <li>SMS      .</li>
     41 <li>Talkback    .</li>
     42 </ul>
     43 
     44 <p>         
     45    .   
     46      
     47       .</p>
     48 
     49 <p>PIN          
     50     .
     51         
     52       . 
     53       
     54      .</p>
     55 
     56 <h2 id="run">      </h2>
     57 
     58 <p>    
     59     
     60     .      
     61 <i></i> .      
     62 <code>android:directBootAware</code>  true .<p>
     63 
     64 <p>         
     65 <code>LOCKED_BOOT_COMPLETED</code>  
     66   .     
     67   ,   
     68              .</p>
     69 
     70 <p>  
     71 {@link android.content.BroadcastReceiver}     
     72 <code>LOCKED_BOOT_COMPLETED</code>    .</p>
     73 
     74 <pre>
     75 &lt;receiver
     76   android:directBootAware="true" &gt;
     77   ...
     78   &lt;intent-filter&gt;
     79     &lt;action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /&gt;
     80   &lt;/intent-filter&gt;
     81 &lt;/receiver&gt;
     82 </pre>
     83 
     84 <p>      
     85          .</p>
     86 
     87 <h2 id="access">   </h2>
     88 
     89 <p>   
     90 <code>Context.createDeviceProtectedStorageContext()</code>   
     91 {@link android.content.Context}  .       API 
     92    . 
     93     
     94     .</p>
     95 
     96 <pre>
     97 Context directBootContext = appContext.createDeviceProtectedStorageContext();
     98 // Access appDataFilename that lives in device encrypted storage
     99 FileInputStream inStream = directBootContext.openFileInput(appDataFilename);
    100 // Use inStream to read content...
    101 </pre>
    102 
    103 <p>     
    104    .
    105        .
    106           
    107     .</p>
    108 
    109 <h2 id="notification">    </h2>
    110 
    111 <p>     
    112       ,
    113          .</p>
    114 
    115 <p>        
    116     {@link android.content.BroadcastReceiver} 
    117 <code>ACTION_USER_UNLOCKED</code>  . ,
    118  {@link android.content.Intent#ACTION_BOOT_COMPLETED
    119 ACTION_BOOT_COMPLETED}    .       
    120  .</p>
    121 
    122 <p>
    123 <code>UserManager.isUserUnlocked()</code>        .</p>
    124 
    125 <h2 id="migrating">  </h2>
    126 
    127 <p>        ,
    128          .
    129 <code>Context.moveSharedPreferencesFrom()</code>
    130 <code>Context.moveDatabaseFrom()</code>         
    131     .</p>
    132 
    133 <p>   
    134        .    
    135      
    136   .  
    137            .</p>
    138 
    139 <h2 id="testing">   </h2>
    140 
    141 <p>       .  
    142     .</p>
    143 
    144 <p class="caution"><strong>:</strong>   
    145     .</p>
    146 
    147 <p>Android N   
    148    :</p>
    149 
    150 <ul>
    151 <li><b>Developer options</b>    
    152 <b>Settings &gt; About phone</b>  <b>Build number</b>
    153 7  .    
    154 <b>Settings &gt; Developer options</b> 
    155 <b>Convert to file encryption</b> .</li>
    156 <li> adb shell      .
    157 <pre class="no-pretty-print">
    158 $ adb reboot-bootloader
    159 $ fastboot --wipe-and-use-fbe
    160 </pre>
    161 </li>
    162 </ul>
    163 
    164 <p>     
    165       .      
    166    .     
    167    .            "No thanks"
    168   
    169 adb shell  .</p>
    170 
    171 <pre class="no-pretty-print">
    172 $ adb shell sm set-emulate-fbe true
    173 </pre>
    174 
    175 <p>       .</p>
    176 
    177 <pre class="no-pretty-print">
    178 $ adb shell sm set-emulate-fbe false
    179 </pre>
    180 
    181 <p>    .</p>
    182