مانند نسخههای قبلی، اندروید ۱۶ شامل تغییرات رفتاری است که ممکن است بر برنامه شما تأثیر بگذارد. تغییرات رفتاری زیر منحصراً برای برنامههایی اعمال میشود که اندروید ۱۶ یا بالاتر را هدف قرار میدهند. اگر برنامه شما اندروید ۱۶ یا بالاتر را هدف قرار میدهد، باید برنامه خود را برای پشتیبانی از این رفتارها، در صورت لزوم، اصلاح کنید.
حتماً فهرست تغییرات رفتاری که صرف نظر از targetSdkVersion برنامه شما، بر همه برنامههای در حال اجرا در اندروید ۱۶ تأثیر میگذارند را نیز بررسی کنید.
تجربه کاربری و رابط کاربری سیستم
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات زیر است که برای ایجاد یک تجربه کاربری سازگارتر و شهودیتر در نظر گرفته شدهاند.
کنار رفتن گزینه انصراف از لبه تا لبه
اندروید ۱۵ برای برنامههایی که اندروید ۱۵ (سطح API ۳۵) را هدف قرار میدهند، پشتیبانی از لبه به لبه را اجباری کرده است ، اما برنامه شما میتواند با تنظیم R.attr#windowOptOutEdgeToEdgeEnforcement روی true ، از این قابلیت انصراف دهد. برای برنامههایی که اندروید ۱۶ (سطح API ۳۶) را هدف قرار میدهند، R.attr#windowOptOutEdgeToEdgeEnforcement منسوخ و غیرفعال شده است و برنامه شما نمیتواند از پشتیبانی از لبه به لبه انصراف دهد.
- اگر برنامه شما اندروید ۱۶ (سطح API ۳۶) را هدف قرار داده و روی دستگاهی با اندروید ۱۵ اجرا میشود،
R.attr#windowOptOutEdgeToEdgeEnforcementبه کار خود ادامه میدهد. - اگر برنامه شما اندروید ۱۶ (سطح API ۳۶) را هدف قرار داده و روی دستگاهی با اندروید ۱۶ اجرا میشود،
R.attr#windowOptOutEdgeToEdgeEnforcementغیرفعال است.
برای آزمایش در اندروید ۱۶، مطمئن شوید که برنامه شما از لبه به لبه پشتیبانی میکند و هرگونه استفاده از R.attr#windowOptOutEdgeToEdgeEnforcement را حذف کنید تا برنامه شما از لبه به لبه در دستگاه اندروید ۱۵ نیز پشتیبانی کند. برای پشتیبانی از لبه به لبه، به راهنمای نوشتن و نمایشها مراجعه کنید.
مهاجرت یا انصراف برای بازگشت پیشبینیکننده الزامی است
برای برنامههایی که اندروید ۱۶ (سطح API ۳۶) یا بالاتر را هدف قرار میدهند و روی دستگاه اندروید ۱۶ یا بالاتر اجرا میشوند، انیمیشنهای سیستم بازگشت پیشبینیکننده (بازگشت به خانه، میانکاری و میانفعالیتی) به طور پیشفرض فعال هستند. علاوه بر این، onBackPressed فراخوانی نمیشود و KeyEvent.KEYCODE_BACK دیگر ارسال نمیشود.
اگر برنامه شما رویداد back را متوقف میکند و شما هنوز به حالت predictive back مهاجرت نکردهاید، برنامه خود را بهروزرسانی کنید تا از APIهای پشتیبانیشده برای ناوبری back استفاده کند ، یا با تنظیم ویژگی android:enableOnBackInvokedCallback به false در تگ <application> یا <activity> از فایل AndroidManifest.xml برنامه خود، موقتاً از این حالت خارج شوید.
APIهای فونت Elegant منسوخ و غیرفعال شدند
برنامههایی که Android 15 را هدف قرار میدهند (سطح API 35) دارای ویژگی elegantTextHeight TextView بهطور پیشفرض روی true تنظیم شدهاند و فونت فشرده را با فونتی که بسیار خواناتر است جایگزین میکند. میتوانید با تنظیم ویژگی elegantTextHeight روی false این مورد را لغو کنید.
Android 16 ویژگی elegantTextHeight را منسوخ میکند، و زمانی که برنامه شما Android 16 را هدف قرار دهد، این ویژگی نادیده گرفته میشود. «فونتهای UI» که توسط این APIها کنترل میشوند، متوقف میشوند، بنابراین باید هر گونه طرحبندی را برای اطمینان از ارائه متن ثابت و ثابت در آینده به زبانهای عربی، لائوس، میانمار، تامیل، گجراتی، مالزی، تایلندی، تلهآلو، کانا تطبیق دهید.

elegantTextHeight برای برنامههایی که Android 14 (سطح API 34) و پایینتر را هدف قرار میدهند، یا برای برنامههایی که Android 15 را هدف قرار میدهند (سطح API 35) که با تنظیم ویژگی elegantTextHeight روی false ، پیشفرض را لغو میکنند. 
elegantTextHeight برای برنامههایی که Android 16 را هدف قرار میدهند (سطح API 36)، یا برای برنامههایی که Android 15 را هدف قرار میدهند (سطح API 35) که با تنظیم ویژگی elegantTextHeight روی false ، پیشفرض را لغو نکردهاند.عملکرد اصلی
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات زیر است که قابلیتهای اصلی مختلف سیستم اندروید را اصلاح یا گسترش میدهد.
بهینهسازی زمانبندی کار با نرخ ثابت
Prior to targeting Android 16, when scheduleAtFixedRate
missed a task execution due to being outside a valid
process lifecycle, all missed executions immediately
execute when the app returns to a valid lifecycle.
When targeting Android 16, at most one missed execution of
scheduleAtFixedRate is immediately executed when the app
returns to a valid lifecycle. This behavior change is expected to improve app
performance. Test this behavior in your app to check if your app is impacted.
You can also test by using the app compatibility framework
and enabling the STPE_SKIP_MULTIPLE_MISSED_PERIODIC_TASKS compat flag.
فاکتورهای شکل دستگاه
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات زیر برای برنامهها هنگام نمایش در دستگاههای صفحه نمایش بزرگ است.
طرحبندیهای تطبیقی
با توجه به اینکه برنامههای اندروید اکنون روی دستگاههای متنوعی (مانند تلفن، تبلت، دستگاههای تاشو، کامپیوترهای رومیزی، ماشین و تلویزیون) اجرا میشوند و حالتهای پنجرهای روی صفحه نمایشهای بزرگ (مانند تقسیم صفحه و پنجرهای کردن دسکتاپ)، توسعهدهندگان باید برنامههای اندرویدی بسازند که صرف نظر از جهتگیری دستگاه، با هر صفحه و اندازه پنجرهای سازگار شوند. الگوهایی مانند محدود کردن جهتگیری و قابلیت تغییر اندازه در دنیای چنددستگاهی امروز بسیار محدودکننده هستند.
محدودیتهای جهتگیری، تغییر اندازه و نسبت ابعاد را نادیده بگیرید
برای برنامههایی که اندروید ۱۶ (سطح API ۳۶) را هدف قرار میدهند، محدودیتهای جهتگیری، تغییر اندازه و نسبت ابعاد دیگر در نمایشگرهایی با کوچکترین عرض >= ۶۰۰dp اعمال نمیشوند. برنامهها کل پنجره نمایشگر را صرف نظر از نسبت ابعاد یا جهتگیری ترجیحی کاربر پر میکنند و از ستونبندی استفاده نمیشود.
این تغییر، یک رفتار استاندارد جدید برای پلتفرم معرفی میکند. اندروید به سمت مدلی حرکت میکند که در آن انتظار میرود برنامهها با جهتگیریها، اندازههای نمایشگر و نسبتهای ابعاد مختلف سازگار شوند. محدودیتهایی مانند جهتگیری ثابت یا قابلیت تغییر اندازه محدود، مانع از سازگاری برنامه میشود. برنامه خود را سازگار کنید تا بهترین تجربه کاربری ممکن را ارائه دهید.
همچنین میتوانید این رفتار را با استفاده از چارچوب سازگاری برنامه و فعال کردن پرچم UNIVERSAL_RESIZABLE_BY_DEFAULT compat آزمایش کنید.
تغییرات رایج در شکستن قفل
نادیده گرفتن محدودیتهای جهتگیری، تغییر اندازه و نسبت ابعاد ممکن است بر رابط کاربری برنامه شما در برخی دستگاهها تأثیر بگذارد، به خصوص عناصری که برای طرحبندیهای کوچک قفلشده در جهت عمودی طراحی شدهاند: برای مثال، مسائلی مانند طرحبندیهای کشیده و انیمیشنها و اجزای خارج از صفحه. هرگونه فرض در مورد نسبت ابعاد یا جهتگیری میتواند باعث مشکلات بصری در برنامه شما شود. درباره نحوه اجتناب از آنها و بهبود رفتار تطبیقی برنامه خود بیشتر بیاموزید .
فعال کردن چرخش دستگاه منجر به ایجاد مجدد فعالیتها میشود که در صورت عدم حفظ صحیح، میتواند منجر به از دست رفتن وضعیت کاربر شود. نحوه ذخیره صحیح وضعیت رابط کاربری را در بخش «ذخیره وضعیتهای رابط کاربری» بیاموزید.
جزئیات پیادهسازی
ویژگیهای مانیفست و APIهای زمان اجرا زیر در دستگاههای با صفحه نمایش بزرگ، در حالتهای تمام صفحه و چند پنجرهای نادیده گرفته میشوند:
-
screenOrientation -
resizableActivity -
minAspectRatio -
maxAspectRatio -
setRequestedOrientation() -
getRequestedOrientation()
مقادیر زیر برای screenOrientation ، setRequestedOrientation() و getRequestedOrientation() نادیده گرفته میشوند:
-
portrait -
reversePortrait -
sensorPortrait -
userPortrait -
landscape -
reverseLandscape -
sensorLandscape -
userLandscape
در مورد قابلیت تغییر اندازه صفحه نمایش، android:resizeableActivity="false" ، android:minAspectRatio و android:maxAspectRatio هیچ تاثیری ندارند.
برای برنامههایی که اندروید ۱۶ (سطح API ۳۶) را هدف قرار میدهند، محدودیتهای جهتگیری برنامه، قابلیت تغییر اندازه و نسبت ابعاد به طور پیشفرض در صفحه نمایشهای بزرگ نادیده گرفته میشوند، اما هر برنامهای که کاملاً آماده نیست میتواند با انصراف (که منجر به رفتار قبلی قرار گرفتن در حالت سازگاری میشود) موقتاً این رفتار را نادیده بگیرد.
استثنائات
محدودیتهای جهتگیری، تغییر اندازه و نسبت تصویر اندروید ۱۶ در شرایط زیر اعمال نمیشوند:
- بازیها (بر اساس پرچم
android:appCategory) - کاربرانی که صریحاً رفتار پیشفرض برنامه را در تنظیمات نسبت ابعاد دستگاه انتخاب میکنند
- صفحه نمایشهایی که کوچکتر از
sw600dpهستند
انصراف موقت
برای غیرفعال کردن یک فعالیت خاص، ویژگی manifest مربوط به PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY را اعلان کنید:
<activity ...>
<property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
...
</activity>
اگر بخشهای زیادی از برنامه شما برای اندروید ۱۶ آماده نیستند، میتوانید با اعمال همین ویژگی در سطح برنامه، بهطور کامل از آن صرفنظر کنید:
<application ...>
<property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
</application>
سلامت و تناسب اندام
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات زیر در رابطه با دادههای سلامت و تناسب اندام است.
مجوزهای سلامت و تناسب اندام
For apps targeting Android 16 (API level 36) or higher,
BODY_SENSORS permissions use more granular permissions
under android.permissions.health, which Health Connect
also uses. As of Android 16, any API previously requiring BODY_SENSORS
or BODY_SENSORS_BACKGROUND requires the corresponding
android.permissions.health permission instead. This affects the following data
types, APIs, and foreground service types:
HEART_RATE_BPMfrom Health Services on Wear OSSensor.TYPE_HEART_RATEfrom Android Sensor ManagerheartRateAccuracyandheartRateBpmfromProtoLayouton Wear OSFOREGROUND_SERVICE_TYPE_HEALTHwhere the respectiveandroid.permission.healthpermission is needed in place ofBODY_SENSORS
If your app uses these APIs, it should request the respective granular permissions:
- For while-in-use monitoring of Heart Rate, SpO2, or Skin Temperature:
request the granular permission under
android.permissions.health, such asREAD_HEART_RATEinstead ofBODY_SENSORS. - For background sensor access: request
READ_HEALTH_DATA_IN_BACKGROUNDinstead ofBODY_SENSORS_BACKGROUND.
These permissions are the same as those that guard access to reading data from Health Connect, the Android datastore for health, fitness, and wellness data.
Mobile apps
Mobile apps migrating to use the READ_HEART_RATE and other granular
permissions must also declare an activity to display
the app's privacy policy. This is the same requirement as Health Connect.
اتصال
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات زیر در پشته بلوتوث برای بهبود اتصال با دستگاههای جانبی است.
اهداف جدید برای مدیریت از دست دادن اوراق قرضه و تغییرات رمزگذاری
به عنوان بخشی از بهبود مدیریت از دست دادن اوراق قرضه ، اندروید 16 همچنین 2 هدف جدید را معرفی می کند تا برنامه ها را با آگاهی بیشتر از از دست دادن اوراق قرضه و تغییرات رمزگذاری ارائه کند.
برنامه هایی که اندروید 16 را هدف قرار می دهند اکنون می توانند:
- هنگامی که از دست دادن اوراق قرضه از راه دور شناسایی شد، یک هدف
ACTION_KEY_MISSINGدریافت کنید، که به آنها امکان می دهد بازخورد آموزنده تری از کاربر ارائه دهند و اقدامات مناسب را انجام دهند. - هر زمان که وضعیت رمزگذاری پیوند تغییر کرد، یک هدف
ACTION_ENCRYPTION_CHANGEدریافت کنید. این شامل تغییر وضعیت رمزگذاری، تغییر الگوریتم رمزگذاری و تغییر اندازه کلید رمزگذاری است. اگر بعداً پس از دریافت هدفACTION_ENCRYPTION_CHANGEپیوند با موفقیت رمزگذاری شد، برنامهها باید پیوند را بازیابی شده در نظر بگیرند.
انطباق با پیاده سازی های مختلف OEM
در حالی که اندروید 16 این اهداف جدید را معرفی میکند، پیادهسازی و پخش آنها میتواند در تولیدکنندگان مختلف دستگاه (OEM) متفاوت باشد. برای اطمینان از اینکه برنامه شما یک تجربه ثابت و قابل اعتماد را در همه دستگاهها ارائه میکند، توسعهدهندگان باید مدیریت تلفات اوراق قرضه خود را طوری طراحی کنند که بهخوبی با این تغییرات بالقوه سازگار شوند.
ما رفتارهای برنامه زیر را توصیه می کنیم:
اگر هدف
ACTION_KEY_MISSINGپخش شود:پیوند ACL (اتصال ناهمگام-کمتر) توسط سیستم قطع خواهد شد، اما اطلاعات پیوند دستگاه حفظ خواهد شد (همانطور که در اینجا توضیح داده شده است).
برنامه شما باید از این هدف بهعنوان سیگنال اصلی برای تشخیص از دست دادن اوراق قرضه استفاده کند و کاربر را راهنمایی کند تا قبل از شروع فراموشی یا جفتسازی مجدد دستگاه تأیید کند که دستگاه راه دور در محدوده است.
اگر دستگاهی پس از دریافت
ACTION_KEY_MISSINGقطع شود، برنامه شما باید در مورد اتصال مجدد محتاط باشد، زیرا ممکن است دستگاه دیگر به سیستم متصل نباشد.اگر هدف
ACTION_KEY_MISSINGپخش نشد:پیوند ACL متصل باقی میماند، و اطلاعات پیوند دستگاه توسط سیستم حذف میشود، مانند رفتار در Android 15.
در این سناریو، برنامه شما باید به مکانیسمهای مدیریت از دست دادن اوراق قرضه موجود خود مانند نسخههای قبلی اندروید ادامه دهد تا رویدادهای از دست دادن اوراق قرضه را شناسایی و مدیریت کند.
روش جدید برای حذف اتصال بلوتوث
All apps targeting Android 16 are now able to unpair bluetooth devices using a
public API in CompanionDeviceManager. If a companion device is
being managed as a CDM association, then the app can trigger
bluetooth bond removal by using the new removeBond(int) API
on the associated device. The app can monitor the bond state changes by
listening to the bluetooth device broadcast event
ACTION_BOND_STATE_CHANGED.
امنیت
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات امنیتی زیر است.
قفل شدن نسخه MediaStore
For apps targeting Android 16 or higher, MediaStore#getVersion() will now
be unique to each app. This eliminates identifying properties from the version
string to prevent abuse and usage for fingerprinting techniques. Apps shouldn't
make any assumptions around the format of this version. Apps should already
handle version changes when using this API and in most cases shouldn't need to
change their current behavior, unless the developer has attempted to infer
additional information that is beyond the intended scope of this API.
مقاصد امنتر
ویژگی Safer Intents یک ابتکار امنیتی چند مرحلهای است که برای بهبود امنیت مکانیسم تشخیص هدف اندروید طراحی شده است. هدف، محافظت از برنامهها در برابر اقدامات مخرب با افزودن بررسیها در طول پردازش هدف و فیلتر کردن اهدافی است که معیارهای خاصی را برآورده نمیکنند.
در اندروید ۱۵، این ویژگی که بر برنامهی فرستنده متمرکز بود، اکنون در اندروید ۱۶، کنترل را به برنامهی گیرنده منتقل میکند و به توسعهدهندگان اجازه میدهد تا با استفاده از مانیفست برنامهی خود، وضوح دقیق هدف را انتخاب کنند.
دو تغییر اساسی در حال اجرا هستند:
اهداف صریح باید با فیلتر هدف کامپوننت هدف مطابقت داشته باشند: اگر یک هدف به صراحت یک کامپوننت را هدف قرار دهد، باید با فیلتر هدف آن کامپوننت مطابقت داشته باشد.
اینتنتهای بدون اکشن نمیتوانند با هیچ فیلتر اینتنتی مطابقت داشته باشند: اینتنتهایی که اکشن مشخصی ندارند، نباید با هیچ فیلتر اینتنتی تطبیق داده شوند.
این تغییرات فقط زمانی اعمال میشوند که چندین برنامه درگیر باشند و بر مدیریت قصد (intent handling) در یک برنامه واحد تأثیری ندارند.
تأثیر
ماهیت اختیاری آن به این معنی است که توسعهدهندگان باید آن را به صراحت در مانیفست برنامه خود فعال کنند تا فعال شود. در نتیجه، تأثیر این ویژگی محدود به برنامههایی خواهد بود که توسعهدهندگان آنها:
- از ویژگی Safer Intents و مزایای آن آگاه هستند.
- فعالانه تصمیم میگیرند که شیوههای سختگیرانهتری را برای مدیریت قصد (intent handling) در برنامههای خود بگنجانند.
این رویکرد انتخابی، خطر از کار افتادن برنامههای موجود را که ممکن است به رفتار فعلیِ با امنیت کمتر برای حل اینتنت متکی باشند، به حداقل میرساند.
اگرچه ممکن است تأثیر اولیه در اندروید ۱۶ محدود باشد، اما ابتکار Safer Intents نقشه راهی برای تأثیر گستردهتر در نسخههای آینده اندروید دارد. این طرح در نهایت به این صورت است که تفکیکپذیری دقیق intent به رفتار پیشفرض تبدیل شود.
ویژگی Safer Intents این پتانسیل را دارد که با دشوارتر کردن سوءاستفاده از آسیبپذیریها در مکانیسم تشخیص هدف (intent resolution)، امنیت اکوسیستم اندروید را به میزان قابل توجهی افزایش دهد.
با این حال، گذار به انصراف و اجرای اجباری باید با دقت مدیریت شود تا مشکلات سازگاری بالقوه با برنامههای موجود برطرف شود.
پیادهسازی
توسعهدهندگان باید با استفاده از ویژگی intentMatchingFlags در مانیفست برنامه خود، تطبیق دقیقتر اینتنت را به صراحت فعال کنند. در اینجا مثالی آورده شده است که در آن این ویژگی برای کل برنامه فعال است، اما در یک گیرنده غیرفعال/غیرفعال است:
<application android:intentMatchingFlags="enforceIntentFilter">
<receiver android:name=".MyBroadcastReceiver" android:exported="true" android:intentMatchingFlags="none">
<intent-filter>
<action android:name="com.example.MY_CUSTOM_ACTION" />
</intent-filter>
<intent-filter>
<action android:name="com.example.MY_ANOTHER_CUSTOM_ACTION" />
</intent-filter>
</receiver>
</application>
اطلاعات بیشتر در مورد پرچمهای پشتیبانیشده:
| نام پرچم | توضیحات |
|---|---|
| فیلتر intent را اعمال کنید | تطبیق دقیقتری را برای اهداف ورودی اعمال میکند |
| هیچ کدام | تمام قوانین تطبیق ویژه را برای ورودیهای ورودی غیرفعال میکند. هنگام تعیین چندین پرچم، مقادیر متناقض با اولویت دادن به پرچم "none" حل میشوند. |
| اجازه دادن به NullAction | قوانین تطبیق را آسان میکند تا به intent های بدون اکشن اجازه تطبیق داده شود. این پرچم همراه با "enforceIntentFilter" برای دستیابی به یک رفتار خاص استفاده میشود. |
تست و اشکالزدایی
وقتی اجرای فعال باشد، اگر فراخوانندهی intent به درستی intent را پر کرده باشد، برنامهها باید به درستی کار کنند. با این حال، intentهای مسدود شده پیامهای هشداری مانند "Intent does not match component's intent filter:" و "Access blocked:" با برچسب "PackageManager." این نشان دهندهی یک مشکل بالقوه است که میتواند بر برنامه تأثیر بگذارد و نیاز به توجه دارد.
فیلتر لاگکت:
tag=:PackageManager & (message:"Intent does not match component's intent filter:" | message: "Access blocked:")
فیلتر کردن فراخوانیهای سیستمی GPU
To harden the Mali GPU surface, Mali GPU IOCTLs that have been deprecated or are intended solely for GPU development have been blocked in production builds. Additionally, IOCTLs used for GPU profiling have been restricted to the shell process or debuggable applications. Refer to the SAC update for more details on the platform-level policy.
This change takes place on Pixel devices using the Mali GPU (Pixel 6-9). Arm
has provided official categorization of their IOCTLs in
Documentation/ioctl-categories.rst of their r54p2 release. This
list will continue to be maintained in future driver releases.
This change does not impact supported graphics APIs (including Vulkan and OpenGL), and is not expected to impact developers or existing applications. GPU profiling tools such as the Streamline Performance Analyzer and the Android GPU Inspector won't be affected.
Testing
If you see a SELinux denial similar to the following, it is likely your application has been impacted by this change:
06-30 10:47:18.617 20360 20360 W roidJUnitRunner: type=1400 audit(0.0:85): avc: denied { ioctl }
for path="/dev/mali0" dev="tmpfs" ino=1188 ioctlcmd=0x8023
scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
permissive=0 app=com.google.android.selinux.pts
If your application needs to use blocked IOCTLs, please file a bug and assign it to android-partner-security@google.com.
FAQ
Does this policy change apply to all OEMs? This change will be opt-in, but available to any OEMs who would like to use this hardening method. Instructions for implementing the change can be found in the implementation documentation.
Is it mandatory to make changes in the OEM codebase to implement this, or does it come with a new AOSP release by default? The platform-level change will come with a new AOSP release by default. Vendors may opt-in to this change in their codebase if they would like to apply it.
Are SoCs responsible for keeping the IOCTL list up to date? For example, if my device uses an ARM Mali GPU, would I need to reach out to ARM for any of the changes? Individual SoCs must update their IOCTL lists per device upon driver release. For example, ARM will update their published IOCTL list upon driver updates. However, OEMs should make sure that they incorporate the updates in their SEPolicy, and add any selected custom IOCTLs to the lists as needed.
Does this change apply to all Pixel in-market devices automatically, or is a user action required to toggle something to apply this change? This change applies to all Pixel in-market devices using the Mali GPU (Pixel 6-9). No user action is required to apply this change.
Will use of this policy impact the performance of the kernel driver? This policy was tested on the Mali GPU using GFXBench, and no measurable change to GPU performance was observed.
Is it necessary for the IOCTL list to align with the current userspace and kernel driver versions? Yes, the list of allowed IOCTLs must be synchronized with the IOCTLs supported by both the userspace and kernel drivers. If the IOCTLs in the user space or kernel driver are updated, the SEPolicy IOCTL list must be updated to match.
ARM has categorized IOCTLs as 'restricted' / 'instrumentation', but we want to use some of them in production use-cases, and/or deny others. Individual OEMs/SoCs are responsible for deciding on how to categorize the IOCTLs they use, based on the configuration of their userspace Mali libraries. ARM's list can be used to help decide on these, but each OEM/SoC's use-case may be different.
حریم خصوصی
اندروید ۱۶ (سطح API ۳۶) شامل تغییرات حریم خصوصی زیر است.
مجوز شبکه محلی
Devices on the LAN can be accessed by any app that has the INTERNET permission.
This makes it easy for apps to connect to local devices but it also has privacy
implications such as forming a fingerprint of the user, and being a proxy for
location.
The Local Network Protections project aims to protect the user's privacy by gating access to the local network behind a new runtime permission.
Release plan
This change will be deployed between two releases, 25Q2 and 26Q2 respectively. It is imperative that developers follow this guidance for 25Q2 and share feedback because these protections will be enforced at a later Android release. Moreover, they will need to update scenarios which depend on implicit local network access by using the following guidance and prepare for user rejection and revocation of the new permission.
Impact
At the current stage, LNP is an opt-in feature which means only the apps that opt in will be affected. The goal of the opt-in phase is for app developers to understand which parts of their app depend on implicit local network access such that they can prepare to permission guard them for the next release.
Apps will be affected if they access the user's local network using:
- Direct or library use of raw sockets on local network addresses (e.g. mDNS or SSDP service discovery protocol)
- Use of framework level classes that access the local network (e.g. NsdManager)
Traffic to and from a local network address requires local network access permission. The following table lists some common cases:
| App Low Level Network Operation | Local Network Permission Required |
|---|---|
| Making an outgoing TCP connection | yes |
| Accepting incoming TCP connections | yes |
| Sending a UDP unicast, multicast, broadcast | yes |
| Receiving an incoming UDP unicast, multicast, broadcast | yes |
These restrictions are implemented deep in the networking stack, and thus they apply to all networking APIs. This includes sockets created in native or managed code, networking libraries like Cronet and OkHttp, and any APIs implemented on top of those. Trying to resolve services on the local network (i.e. those with a .local suffix) will require local network permission.
Exceptions to the rules above:
- If a device's DNS server is on a local network, traffic to or from it (at port 53) doesn't require local network access permission.
- Applications using Output Switcher as their in-app picker won't need local network permissions (more guidance to come in 2025Q4).
Developer Guidance (Opt-in)
To opt into local network restrictions, do the following:
- Flash the device to a build with 25Q2 Beta 3 or later.
- Install the app to be tested.
Toggle the Appcompat flag in adb:
adb shell am compat enable RESTRICT_LOCAL_NETWORK <package_name>Reboot The device
Now your app's access to the local network is restricted and any attempt to access the local network will lead to socket errors. If you are using APIs that perform local network operations outside of your app process (ex: NsdManager), they won't be impacted during the opt-in phase.
To restore access, you must grant your app permission to NEARBY_WIFI_DEVICES.
- Ensure the app declares the
NEARBY_WIFI_DEVICESpermission in its manifest. - Go to Settings > Apps > [Application Name] > Permissions > Nearby devices > Allow.
Now your app's access to the local network should be restored and all your scenarios should work as they did prior to opting the app in.
Once enforcement for local network protection begins, here is how the app network traffic will be impacted.
| Permission | Outbound LAN Request | Outbound/Inbound Internet Request | Inbound LAN Request |
|---|---|---|---|
| Granted | Works | Works | Works |
| Not Granted | Fails | Works | Fails |
Use the following command to toggle-off the App-Compat flag
adb shell am compat disable RESTRICT_LOCAL_NETWORK <package_name>
Errors
Errors arising from these restrictions will be returned to the calling socket whenever it invokes send or a send variant to a local network address.
Example errors:
sendto failed: EPERM (Operation not permitted)
sendto failed: ECONNABORTED (Operation not permitted)
Local Network Definition
A local network in this project refers to an IP network that utilizes a broadcast-capable network interface, such as Wi-Fi or Ethernet, but excludes cellular (WWAN) or VPN connections.
The following are considered local networks:
IPv4:
- 169.254.0.0/16 // Link Local
- 100.64.0.0/10 // CGNAT
- 10.0.0.0/8 // RFC1918
- 172.16.0.0/12 // RFC1918
- 192.168.0.0/16 // RFC1918
IPv6:
- Link-local
- Directly-connected routes
- Stub networks like Thread
- Multiple-subnets (TBD)
Additionally, both multicast addresses (224.0.0.0/4, ff00::/8) and the IPv4 broadcast address (255.255.255.255) are classified as local network addresses.
عکسهای متعلق به برنامه
When prompted for photo and video permissions by an app targeting SDK 36 or higher on devices running Android 16 or higher, users who choose to limit access to selected media will see any photos owned by the app pre-selected in the photo picker. Users can deselect any of these pre-selected items, which will revoke the app's access to those photos and videos.