שינויים בהתנהגות: אפליקציות שמטרגטות את Android מגרסה 17 ואילך

בדומה לגרסאות קודמות, Android 17 כולל שינויים בהתנהגות שעשויים להשפיע על האפליקציה שלכם. שינויי ההתנהגות הבאים רלוונטיים רק לאפליקציות שמטרגטות את Android 17 ואילך. אם האפליקציה שלכם מטרגטת את Android מגרסה 17 ואילך, אתם צריכים לשנות את האפליקציה כדי שהיא תתמוך בהתנהגויות האלה, במקרים הרלוונטיים.

חשוב גם לבדוק את רשימת השינויים בהתנהגות שמשפיעים על כל האפליקציות שפועלות ב-Android 17, בלי קשר ל-targetSdkVersion של האפליקציה.

פונקציונליות עיקרית

‫Android 17 כוללת את השינויים הבאים, שמשנים או מרחיבים יכולות ליבה שונות של מערכת Android.

הטמעה חדשה של MessageQueue שלא דורשת נעילה

החל מ-Android 17, אפליקציות שמטרגטות את Android 17 (רמת API 37) או גרסאות חדשות יותר מקבלות הטמעה חדשה ללא נעילה של android.os.MessageQueue. ההטמעה החדשה משפרת את הביצועים ומפחיתה את מספר הפריימים החסרים, אבל היא עלולה לגרום לשיבוש בלקוחות שמשקפים שדות ושיטות פרטיים.MessageQueue

מידע נוסף, כולל אסטרטגיות להפחתת הסיכון, זמין במאמר הנחיות לשינוי התנהגות של MessageQueue.

אי אפשר יותר לשנות שדות סופיים סטטיים

באפליקציות שפועלות ב-Android 17 ומעלה ומטרגטות ל-Android 17 (רמת API 37) ומעלה, אי אפשר לשנות שדות static final. אם אפליקציה מנסה לשנות שדה static final באמצעות רפלקציה, היא תגרום ל-IllegalAccessException. ניסיון לשנות אחד מהשדות האלה באמצעות ממשקי JNI API (כמו SetStaticLongField()) יגרום לקריסת האפליקציה.

נגישות

ב-Android 17 בוצעו השינויים הבאים כדי לשפר את הנגישות.

תמיכה בנגישות להקלדה במקלדת פיזית ב-IME מורכב

This feature introduces new AccessibilityEvent and TextAttribute APIs to enhance screen reader spoken feedback for CJKV language input. CJKV IME apps can now signal whether a text conversion candidate has been selected during text composition. Apps with edit fields can specify text change types when sending text changed accessibility events. For example, apps can specify that a text change occurred during text composition, or that a text change resulted from a commit. Doing this enables accessibility services such as screen readers to deliver more precise feedback based on the nature of the text modification.

App adoption

  • IME Apps: When setting composing text in edit fields, IMEs can use TextAttribute.Builder.setTextSuggestionSelected() to indicate whether a specific conversion candidate was selected.

  • Apps with Edit Fields: Apps that maintain a custom InputConnection can retrieve candidate selection data by calling TextAttribute.isTextSuggestionSelected(). These apps should then call AccessibilityEvent.setTextChangeTypes() when dispatching TYPE_VIEW_TEXT_CHANGED events. Apps targeting Android 17 (API level 37) that use the standard TextView will have this feature enabled by default. (That is, TextView will handle retrieving data from the IME and setting text change types when sending events to accessibility services).

  • Accessibility Services: Accessibility services that process TYPE_VIEW_TEXT_CHANGED events can call AccessibilityEvent.getTextChangeTypes() to identify the nature of the modification and adjust their feedback strategies accordingly.

פרטיות

‫Android 17 כוללת את השינויים הבאים לשיפור פרטיות המשתמשים.

ההגדרה ECH (הצפנת Client Hello) מופעלת

Android 17 introduces platform support for Encrypted Client Hello (ECH), a TLS extension that enhances user privacy by encrypting the Server Name Indication (SNI) in the TLS handshake. This encryption helps prevent network observers from easily identifying the specific domain your app is connecting to.

For apps targeting Android 17 (API level 37) or higher, ECH is used for TLS connections. ECH is active only if the networking library used by the app (for example, HttpEngine, WebView, or OkHttp) has integrated ECH support and the remote server also supports the ECH protocol. If ECH cannot be negotiated, the client sends an ECH extension with randomized contents (a mechanism called ECH GREASE). See RFC 9849 for more details on how ECH GREASE works.

To allow apps to customize this behavior, Android 17 adds a new <domainEncryption> element to the Network Security Configuration file. Developers can use <domainEncryption> within <base-config> or <domain-config> tags to select an ECH mode (for example, "enabled" or "disabled") on a global or per-domain basis.

For more information, see the Encrypted Client Hello documentation.

נדרשת הרשאה לגישה לרשת המקומית לאפליקציות שמיועדות ל-Android 17

Android 17 introduces the ACCESS_LOCAL_NETWORK runtime permission to protect users from unauthorized local network access. Because this falls under the existing NEARBY_DEVICES permission group, users who have already granted other NEARBY_DEVICES permissions aren't prompted again. This new requirement prevents malicious apps from exploiting unrestricted local network access for covert user tracking and fingerprinting. By declaring and requesting this permission, your app can discover and connect to devices on the local area network (LAN), such as smart home devices or casting receivers.

Apps targeting Android 17 (API level 37) or higher now have two paths to maintain communication with LAN devices: Adopt system-mediated, privacy-preserving device pickers to skip the permission prompt, or explicitly request this new permission at runtime to maintain local network communication.

For more information, see the Local network permission documentation.

הסתרת סיסמאות ממכשירים פיזיים

If an app targets Android 17 (API level 37) or higher and the user is using a physical input device (for example, an external keyboard), the Android operating system applies the new show_passwords_physical setting to all characters in the password field. By default, that setting hides all password characters.

The Android system shows the last-typed password character to help the user see if they mistyped the password. However, this is much less necessary with larger external keyboards. In addition, devices with external keyboards often have larger displays, which increases the danger of someone seeing the typed password.

If the user is using the device's touchscreen, the system applies the new show_passwords_touch setting.

הגנה על OTP בהודעות SMS רגילות

Beginning with Android 17, Android is extending its SMS OTP protection to apply to standard SMS messages (SMS messages containing an OTP that do not use the WebOTP or SMS Retriever formats). For most apps targeting Android 17 (API level 37) or higher, these SMS messages do not become available until three hours after receipt. This delay is intended to help prevent OTP hijacking. During this three hour delay, the SMS_RECEIVED_ACTION broadcast is withheld and SMS provider database queries are filtered. The SMS message is available to these apps after the delay.

Certain apps such as the default SMS assistant app, connected device companion apps, etc., are exempted from this delay. All apps that rely on reading SMS messages for OTP extraction should transition to using SMS Retriever or SMS User Consent APIs to ensure continued functionality.

אבטחה

ב-Android 17 בוצעו השיפורים הבאים באבטחת המכשירים והאפליקציות.

אבטחת פעילות

ב-Android 17, הפלטפורמה ממשיכה את המעבר לארכיטקטורה של 'אבטחה כברירת מחדל', ומציגה חבילה של שיפורים שנועדו לצמצם את הסיכון לניצול לרעה של פרצות חמורות כמו פישינג, חטיפת אינטראקציות ומתקפות confused deputy. בעקבות העדכון הזה, המפתחים נדרשים להביע הסכמה מפורשת לתקני אבטחה חדשים כדי לשמור על תאימות האפליקציה ועל הגנת המשתמשים.

ההשפעות העיקריות על מפתחים כוללות:

  • הגברת האבטחה של BAL ושיפור ההסכמה להצטרפות: אנחנו משפרים את ההגבלות על הפעלה של פעילות ברקע (BAL) על ידי הרחבת ההגנה ל-IntentSender. המפתחים צריכים להפסיק להשתמש בקבוע MODE_BACKGROUND_ACTIVITY_START_ALLOWED מדור קודם. במקום זאת, מומלץ להשתמש באמצעי בקרה מפורטים כמו MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, שמגביל את הפעלת הפעילות לתרחישים שבהם האפליקציה המתקשרת גלויה, וכך מצמצם באופן משמעותי את שטח הפנים של המתקפה.
  • כלים להטמעה: מפתחים צריכים להשתמש במצב קפדני ובבדיקות lint מעודכנות כדי לזהות דפוסים מדור קודם ולהבטיח מוכנות לדרישות עתידיות של SDK לטירגוט.

הפעלה של CT כברירת מחדל

If an app targets Android 17 (API level 37) or higher, certificate transparency (CT) is enabled by default. (On Android 16, CT is available but apps had to opt in.)

‫Safer Native DCL—C

אם האפליקציה מטרגטת ל-Android 17 (רמת API 37) או לגרסה מתקדמת יותר, ההגנה על טעינה דינמית (DCL) של קוד, שהוצגה ב-Android 14 לקובצי DEX ו-JAR, חלה עכשיו גם על ספריות Native.

כל הקבצים המקוריים שנטענו באמצעות System.load() צריכים להיות מסומנים כקריאה בלבד. אחרת, המערכת תציג את השגיאה UnsatisfiedLinkError.

מומלץ להימנע ככל האפשר מטעינה דינמית של קוד באפליקציות, כי פעולה כזו מגדילה מאוד את הסיכון שאפליקציה תיפרץ על ידי הזרקת קוד או שינוי קוד.

הגבלת שדות של פרטים אישיים מזהים בתצוגת הנתונים של CP2

באפליקציות שמיועדות ל-Android 17 (API ברמה Android 17 (API ברמה 37)) ומעלה, ניהול אנשי הקשר 2 (CP2) מגביל את הגישה לכמה עמודות שמכילות פרטים אישיים מזהים (PII) בתצוגת הנתונים. כשהשינוי הזה מופעל, העמודות האלה מוסרות מתצוגת הנתונים כדי לשפר את הפרטיות של המשתמשים. העמודות המוגבלות כוללות:

אפליקציות שמשתמשות בעמודות האלה מ-ContactsContract.Data יכולות לחלץ אותן מ-ContactsContract.RawContacts במקום זאת, על ידי הצטרפות ל-RAW_CONTACT_ID.

אכיפה של בדיקות SQL מחמירות ב-CP2

For apps targeting Android 17 (API level Android 17 (API level 37)) and higher, Contacts Provider 2 (CP2) enforces strict SQL query validation when the ContactsContract.Data table is accessed without READ_CONTACTS permission.

With this change, if an app doesn't have READ_CONTACTS permission, StrictColumns and StrictGrammar options are set when querying the ContactsContract.Data table. If a query uses a pattern that isn't compatible with these, it will be rejected and cause an exception to be thrown.

מדיה

‫Android 17 כוללת את השינויים הבאים בהתנהגות של מדיה.

הגברת האבטחה של אודיו ברקע

Beginning with Android 17, the audio framework enforces restrictions on background audio interactions including audio playback, audio focus requests, and volume change APIs to ensure that these changes are started intentionally by the user.

Some audio restrictions apply to all apps. However, the restrictions are more stringent if an app targets Android 17 (API level 37). If one of these apps interacts with audio while it is in the background, it must have a foreground service running. In addition, the app must meet one or both of these requirements:

  • The foreground service must have while-in-use (WIU) capabilities.
  • The app must have the exact alarm permission and be interacting with USAGE_ALARM audio streams.

For more information, including mitigation strategies, see Background audio hardening.

גורמי צורה של מכשירים

‫Android 17 כוללת את השינויים הבאים לשיפור חוויית המשתמש במגוון גדלים וסוגים של מכשירים.

שינויים ב-API של הפלטפורמה שגורמים להתעלמות מהגבלות על כיוון, שינוי גודל ויחס גובה-רוחב במסכים גדולים (sw>=600dp)

הוספנו שינויים ב-API של הפלטפורמה ב-Android 16 כדי להתעלם מהגבלות על כיוון, יחס גובה-רוחב ושינוי גודל במסכים גדולים (sw ‏ >= 600dp) באפליקציות שמטרגטות לרמת API 36 ומעלה. מפתחים יכולים להשבית את השינויים האלה ב-SDK 36, אבל האפשרות הזו לא תהיה זמינה יותר לאפליקציות שמיועדות ל-Android 17 (רמת API 37) ומעלה.

מידע נוסף זמין במאמר בנושא התעלמות מהגבלות על כיוון ושינוי גודל.

קישוריות

ב-Android 17 בוצע השינוי הבא כדי לשפר את העקביות ולהתאים להתנהגות הרגילה של שקעי RFCOMM ב-Bluetooth ב-Java InputStream.

התנהגות עקבית של read() ב-BluetoothSocket עבור RFCOMM

באפליקציות שמטרגטות ל-Android 17 (רמת API 37), השיטה read() של InputStream שמתקבלת מ-BluetoothSocket מבוסס RFCOMM מחזירה עכשיו -1 כשהסוקט סגור או כשהחיבור נותק.

השינוי הזה גורם להתנהגות של שקע RFCOMM להיות עקבית עם שקעי LE CoC, ומתאים למסמכי התיעוד של התקן InputStream.read(), שבהם מצוין שהערך -1 מוחזר כשמגיעים לסוף הזרם.

אפליקציות שמסתמכות רק על תפיסה של IOException כדי לצאת מלולאת קריאה עשויות להיות מושפעות מהשינוי הזה, ולכן צריך לעדכן את לולאות הקריאה של BluetoothSocket כדי לבדוק באופן מפורש אם ערך ההחזרה הוא -1. כך מבטיחים שהלולאה תסתיים בצורה נכונה כשהמכשיר שמחובר לרשת אחרת מתנתק או כשהשקע נסגר. דוגמה להטמעה המומלצת מופיעה בקטע קוד במדריך העברת נתונים באמצעות Bluetooth.