Android 17 มีการเปลี่ยนแปลงลักษณะการทำงานที่อาจส่งผลต่อแอปของคุณเช่นเดียวกับรุ่นก่อนหน้า การเปลี่ยนแปลงลักษณะการทำงานต่อไปนี้มีผลเฉพาะกับแอปที่กำหนดเป้าหมายเป็น Android 17 ขึ้นไป หากแอปกำหนดเป้าหมายเป็น Android 17 ขึ้นไป คุณควรแก้ไขแอปให้รองรับลักษณะการทำงานเหล่านี้ (หากมี)
อย่าลืมตรวจสอบรายการการเปลี่ยนแปลงลักษณะการทำงานที่ส่งผลต่อแอปทั้งหมดที่ทำงานใน Android 17 ไม่ว่าแอปของคุณจะมี targetSdkVersion เป็นเวอร์ชันใดก็ตาม
ประสบการณ์ของผู้ใช้และ UI ของระบบ
Android 17 มีการเปลี่ยนแปลงต่อไปนี้ซึ่งมีจุดประสงค์เพื่อสร้างประสบการณ์ของผู้ใช้ที่สอดคล้องและใช้งานง่ายยิ่งขึ้น
วิดเจ็ตขีดจำกัดหน่วยความจำ
Beginning with Android 17, the system enforces a strict memory limit on
RemoteViews updates for apps targeting Android 17 (API level 37) or
higher. When an app passes a RemoteViews object to
AppWidgetManager.updateAppWidget,
system_server calculates the total memory footprint of all image data across
every orientation and size bucket in the payload. If the total memory exceeds
the system ceiling (mMaxWidgetBitmapMemory), the system rejects the update and
throws an IllegalArgumentException:
java.lang.IllegalArgumentException: RemoteViews for widget update exceeds maximum bitmap memory usage (used: XXXXX, max: YYYYY)
For apps targeting API level 36 or lower, the system logs this memory violation
as a warning (Slog.w) without throwing an exception.
Android skills
View on GitHub
Manage AppWidget updates and bitmap memory
android skills add glance-appwidget-updates-and-memory
How the system calculates the memory ceiling
The system sets the widget bitmap memory budget at 6 * width * height bytes
(1.5 * 4 * width * height, equivalent to 1.5 times the size of a full-screen
ARGB_8888 buffer) for the active display configuration. Under API level 37 and
higher, this calculation includes both of the following:
- In-memory
Bitmapand bitmap-backedIconobjects (Icon.TYPE_BITMAPandIcon.TYPE_ADAPTIVE_BITMAP) stored inRemoteViews.mBitmapCache(such as calls tosetImageViewBitmap,Icon.createWithBitmap,Icon.createWithAdaptiveBitmap, or Jetpack GlanceImageProvider(bitmap)). Each uniqueBitmapor bitmap-backedIconinstance inmBitmapCacheis counted once perRemoteViewshierarchy. - URI-backed images (
Icon.createWithContentUri,setImageViewUri, or GlanceImageProvider(uri)) don't count toward theRemoteViewsIPC byte cap insystem_server, but the widget host process decodes the referencedcontent://file at full resolution into its own heap. Always write a downsampled image intocontext.cacheDirbefore exposing it through aFileProviderURI.
Mitigation steps
To keep your widget updates within the memory ceiling across phones, tablets, and foldables, do the following:
Compute your runtime memory budget from
WindowMetrics: On API level 30 and higher, read the active window bounds fromWindowManager.currentWindowMetrics.boundsrather thanresources.displayMetrics. On multi-resolution devices and foldables,displayMetricscan report inactive display dimensions. Estimate your total widget image budget at6L * bounds.width() * bounds.height()as shown in the following example:private const val FALLBACK_MAX_BYTES = 15_000_000L fun calculateWidgetMemoryCapBytes(context: Context): Long { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { val wm = context.getSystemService(WindowManager::class.java) ?: return FALLBACK_MAX_BYTES val bounds = wm.currentWindowMetrics.bounds return 6L * bounds.width().toLong() * bounds.height().toLong() } val dm = context.resources.displayMetrics return 6L * dm.widthPixels.toLong() * dm.heightPixels.toLong() }Downsample images to the widget's viewable dimensions and use
RGB_565: Decode bitmaps with power-of-twoBitmapFactory.Options.inSampleSizevalues sized to the widget's maximum display dimensions (maxWidthDpbymaxHeightDp), and useBitmap.Config.RGB_565(2bytes per pixel) instead ofARGB_8888(4bytes per pixel) for opaque photographs and thumbnails.Hoist bitmap decoding outside
provideContentin Jetpack Glance: When usingSizeMode.ResponsiveorSizeMode.Exact, Glance invokes yourprovideContentlambda once per size bucket. Decode each sharedBitmaponce insideprovideGlancebefore callingprovideContentso all size buckets reference the sameBitmapinstance inRemoteViews.mBitmapCache.Use full
updateAppWidgetcalls when replacing images: In classicAppWidgetProviderimplementations, avoid callingAppWidgetManager.partiallyUpdateAppWidgetto swapBitmaporIconviews. Partial updates merge new actions into the existingRemoteViewstree insystem_serverwithout evicting previously cached image actions. Build a completeRemoteViewslayout and callupdateAppWidgetinstead.Provide an error fallback layout: In Jetpack Glance, override
onCompositionErrorto render a zero-bitmapRemoteViewsfallback if an update fails.
You can inspect your widget's current serialized bitmap memory usage on a connected device by running the following:
adb shell dumpsys appwidget
ฟังก์ชันหลัก
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 ที่ซับซ้อน
ฟีเจอร์นี้เปิดตัว API AccessibilityEvent และ TextAttribute ใหม่เพื่อปรับปรุงการอธิบายและอ่านออกเสียงของโปรแกรมอ่านหน้าจอสำหรับการป้อนข้อมูลภาษา CJKV ตอนนี้แอป CJKV IME สามารถส่งสัญญาณได้ว่ามีการเลือกตัวเลือกการแปลงข้อความระหว่างการเขียนข้อความหรือไม่ แอปที่มีช่องแก้ไขสามารถระบุประเภทการเปลี่ยนแปลงข้อความเมื่อส่งเหตุการณ์การช่วยเหลือพิเศษที่ข้อความมีการเปลี่ยนแปลง
ตัวอย่างเช่น แอปสามารถระบุได้ว่าการเปลี่ยนแปลงข้อความเกิดขึ้นระหว่างการเขียนข้อความ หรือการเปลี่ยนแปลงข้อความเกิดจากการคอมมิต
การดำเนินการนี้จะช่วยให้บริการการช่วยเหลือพิเศษ เช่น โปรแกรมอ่านหน้าจอ แสดงความคิดเห็นที่แม่นยำยิ่งขึ้นตามลักษณะของการแก้ไขข้อความ
การรับแอปไปใช้งาน
แอป IME: เมื่อตั้งค่าการเขียนข้อความในช่องแก้ไข IME สามารถใช้
TextAttribute.Builder.setTextSuggestionSelected()เพื่อระบุว่ามีการเลือกตัวเลือก Conversion ที่เฉพาะเจาะจงหรือไม่แอปที่มีช่องแก้ไข: แอปที่รักษา
InputConnectionที่กำหนดเองจะดึงข้อมูลการเลือกผู้สมัครได้โดยการเรียกใช้TextAttribute.isTextSuggestionSelected()จากนั้นแอปเหล่านี้ควรเรียกใช้AccessibilityEvent.setTextChangeTypes()เมื่อส่งเหตุการณ์TYPE_VIEW_TEXT_CHANGEDแอปที่กำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ซึ่งใช้TextViewมาตรฐานจะเปิดใช้ฟีเจอร์นี้โดยค่าเริ่มต้น (กล่าวคือTextViewจะจัดการการดึงข้อมูลจาก IME และการตั้งค่าประเภทการเปลี่ยนแปลงข้อความเมื่อส่งเหตุการณ์ไปยังบริการการช่วยเหลือพิเศษ)บริการการช่วยเหลือพิเศษ: บริการการช่วยเหลือพิเศษที่ประมวลผลเหตุการณ์
TYPE_VIEW_TEXT_CHANGEDสามารถเรียกใช้AccessibilityEvent.getTextChangeTypes()เพื่อระบุลักษณะของการแก้ไขและปรับกลยุทธ์การแสดงความคิดเห็นให้สอดคล้องกัน
ความเป็นส่วนตัว
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงความเป็นส่วนตัวของผู้ใช้
เปิดใช้ ECH (Encrypted 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 เปิดตัวสิทธิ์รันไทม์ ACCESS_LOCAL_NETWORK เพื่อปกป้องผู้ใช้จากการเข้าถึงเครือข่ายภายในโดยไม่ได้รับอนุญาต เนื่องจากสิทธิ์นี้อยู่ภายใต้กลุ่มสิทธิ์ NEARBY_DEVICES ที่มีอยู่ ผู้ใช้ที่ให้สิทธิ์ NEARBY_DEVICES อื่นๆ ไปแล้วจะไม่ได้รับข้อความแจ้งอีก ข้อกำหนดใหม่นี้จะป้องกันไม่ให้แอปที่เป็นอันตรายใช้ประโยชน์จากการเข้าถึงเครือข่ายภายในแบบไม่จำกัดเพื่อติดตามผู้ใช้และทำฟิงเกอร์ปรินต์อย่างลับๆ การประกาศและขอสิทธิ์นี้จะช่วยให้แอปค้นพบและเชื่อมต่อกับอุปกรณ์ในเครือข่ายเฉพาะที่ (LAN) ได้ เช่น อุปกรณ์สมาร์ทโฮมหรือตัวรับสัญญาณการแคสต์
ตอนนี้แอปที่กำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ขึ้นไปมี 2 วิธีในการคงการสื่อสารกับอุปกรณ์ LAN ไว้ ได้แก่ ใช้เครื่องมือเลือกอุปกรณ์ที่รักษาความเป็นส่วนตัวซึ่งระบบเป็นสื่อกลางเพื่อข้ามข้อความแจ้งสิทธิ์ หรือขอสิทธิ์ใหม่นี้อย่างชัดแจ้งที่รันไทม์เพื่อคงการสื่อสารในเครือข่าย LAN ไว้
ดูข้อมูลเพิ่มเติมได้ในเอกสารประกอบเกี่ยวกับสิทธิ์เข้าถึงเครือข่าย LAN
การซ่อนรหัสผ่านจากอุปกรณ์จริง
หากแอปกำหนดเป้าหมายเป็น Android 17 (ระดับ API 37) ขึ้นไป และผู้ใช้กำลังใช้อุปกรณ์อินพุตจริง (เช่น แป้นพิมพ์ภายนอก) ระบบปฏิบัติการ Android จะใช้การตั้งค่า show_passwords_physical ใหม่กับอักขระทั้งหมดในช่องรหัสผ่าน โดยค่าเริ่มต้น การตั้งค่านั้นจะซ่อนอักขระรหัสผ่านทั้งหมด
ระบบ Android จะแสดงอักขระรหัสผ่านที่พิมพ์ล่าสุดเพื่อช่วยให้ผู้ใช้เห็นว่าพิมพ์รหัสผ่านผิดหรือไม่ อย่างไรก็ตาม แป้นพิมพ์ภายนอกขนาดใหญ่ไม่จำเป็นต้องใช้แป้นพิมพ์ลัดเหล่านี้มากนัก นอกจากนี้ อุปกรณ์ที่มีแป้นพิมพ์ภายนอกมักจะมีจอแสดงผลขนาดใหญ่ขึ้น ซึ่งเพิ่มความเสี่ยงที่ผู้อื่นจะเห็นรหัสผ่านที่พิมพ์
หากผู้ใช้ใช้หน้าจอสัมผัสของอุปกรณ์ ระบบจะใช้การตั้งค่า show_passwords_touch ใหม่
การปกป้อง 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 มีการปรับปรุงความปลอดภัยของอุปกรณ์และแอปดังต่อไปนี้
การรักษาความปลอดภัยของกิจกรรม
In Android 17, the platform continues its shift toward a "secure-by-default" architecture, introducing a suite of enhancements designed to mitigate high-severity exploits such as phishing, interaction hijacking, and confused deputy attacks. This update requires developers to explicitly opt in to new security standards to maintain app compatibility and user protection.
Key impacts for developers include:
- BAL hardening & improved opt-in: We are refining Background Activity
Launch (BAL) restrictions by extending protections to
IntentSender. Developers must migrate away from the legacyMODE_BACKGROUND_ACTIVITY_START_ALLOWEDconstant. Instead, you should adopt granular controls likeMODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, which restricts activity starts to scenarios where the calling app is visible, significantly reducing the attack surface. - Adoption tools: Developers should utilize strict mode and updated lint checks to identify legacy patterns and ensure readiness for future target SDK requirements.
เปิดใช้ CT โดยค่าเริ่มต้น
หากแอปกำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ขึ้นไป ระบบจะเปิดใช้ความโปร่งใสของใบรับรอง (CT) โดยค่าเริ่มต้น (ใน Android 16, CT พร้อมใช้งาน แต่แอปต้องเลือกใช้)
Safer Native DCL—C
หากแอปกำหนดเป้าหมายเป็น Android 17 (ระดับ API 37) ขึ้นไป การปกป้องการโหลดโค้ดแบบไดนามิก (DCL) ที่ปลอดภัยยิ่งขึ้นซึ่งเปิดตัวใน Android 14 สำหรับไฟล์ DEX และ JAR จะขยายไปยังไลบรารีแบบเนทีฟด้วย
ไฟล์เนทีฟทั้งหมดที่โหลดโดยใช้ System.load() ต้องทำเครื่องหมายเป็นแบบอ่านอย่างเดียว
ไม่เช่นนั้น ระบบจะแสดง UnsatisfiedLinkError
เราขอแนะนำให้แอปหลีกเลี่ยงการโหลดโค้ดแบบไดนามิกเมื่อเป็นไปได้ เนื่องจากการทำเช่นนี้จะเพิ่มความเสี่ยงอย่างมากที่แอปจะถูกบุกรุกด้วยการแทรกโค้ดหรือการปลอมแปลงโค้ด
จำกัดช่อง PII ในมุมมองข้อมูล CP2
For apps targeting Android 17 (API level 37) and higher, Contacts Provider 2 (CP2) restricts certain columns containing Personally Identifiable Information (PII) from the data view. When this change is enabled, these columns are removed from the data view to enhance user privacy. The restricted columns include:
Apps that are using these columns from ContactsContract.Data
can extract them from ContactsContract.RawContacts
instead, by joining with RAW_CONTACT_ID.
บังคับใช้การตรวจสอบ SQL ที่เข้มงวดใน CP2
สำหรับแอปที่กำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ขึ้นไป Contacts Provider 2 (CP2) จะบังคับใช้การตรวจสอบความถูกต้องของคำค้นหา SQL อย่างเข้มงวดเมื่อมีการเข้าถึงตาราง ContactsContract.Data โดยไม่มีสิทธิ์ READ_CONTACTS
การเปลี่ยนแปลงนี้หมายความว่าหากแอปไม่มีสิทธิ์ READ_CONTACTS ระบบจะตั้งค่าตัวเลือก StrictColumns และ StrictGrammar เมื่อค้นหาตาราง ContactsContract.Data หากการค้นหาใช้รูปแบบที่เข้ากันไม่ได้กับรูปแบบเหล่านี้ ระบบจะปฏิเสธการค้นหาและทำให้เกิดข้อยกเว้น
การตรวจหา
Android 17 มีการเปลี่ยนแปลงต่อไปนี้ในระบบอัจฉริยะ
การเลิกใช้งาน setContentCaptureEnabled
Content Capture is enabled by default on certain devices to allow on-device AI features to analyze screen contents for intelligent experiences.
Starting in Android 17, the
ContentCaptureManager.setContentCaptureEnabled(boolean)
API method is deprecated. For apps that target Android 17 (API level 37) or
higher, calling setContentCaptureEnabled(false) no longer disables Content
Capture.
If your app needs to continue disabling Content Capture or restrict screen
contents from being captured by the system, you must transition to using the
FLAG_SECURE window layout parameter.
To disable Content Capture, set the FLAG_SECURE flag on your window as shown
in the following example:
Kotlin
window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
Java
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
);
For more details, see the
WindowManager.LayoutParams.FLAG_SECURE reference
documentation.
สื่อ
Android 17 มีการเปลี่ยนแปลงต่อไปนี้ในลักษณะการทำงานของสื่อ
การเพิ่มความปลอดภัยของเสียงในเบื้องหลัง
ตั้งแต่ Android 17 เป็นต้นไป เฟรมเวิร์กเสียงจะบังคับใช้ข้อจำกัดเกี่ยวกับการโต้ตอบกับเสียงในเบื้องหลัง ซึ่งรวมถึงการเล่นเสียง คำขอโฟกัสเสียง และ API การเปลี่ยนแปลงระดับเสียง เพื่อให้มั่นใจว่าการเปลี่ยนแปลงเหล่านี้เริ่มต้นโดยเจตนาของผู้ใช้
ข้อจำกัดด้านเสียงบางอย่างจะมีผลกับแอปทั้งหมด อย่างไรก็ตาม ข้อจำกัดจะเข้มงวดมากขึ้นหากแอปกำหนดเป้าหมายเป็น Android 17 (ระดับ API 37) หากแอปใดแอปหนึ่งเหล่านี้โต้ตอบกับเสียงขณะที่ทำงานอยู่เบื้องหลัง แอปนั้นต้องมีบริการที่ทำงานอยู่เบื้องหน้า นอกจากนี้ แอปต้องเป็นไปตามข้อกำหนดข้อใดข้อหนึ่งหรือทั้ง 2 ข้อต่อไปนี้
- บริการที่ทำงานอยู่เบื้องหน้าต้องมีความสามารถขณะใช้งาน (WIU)
- แอปต้องมีสิทธิ์สัญญาณปลุกเจาะจงและโต้ตอบกับสตรีมเสียง
USAGE_ALARM
ดูข้อมูลเพิ่มเติม รวมถึงกลยุทธ์การลดความเสี่ยงได้ที่การเพิ่มความปลอดภัยของเสียงในเบื้องหลัง
รูปแบบของอุปกรณ์
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงประสบการณ์ของผู้ใช้ในอุปกรณ์ขนาดและรูปแบบต่างๆ
การเปลี่ยนแปลง Platform API เพื่อละเว้นข้อจำกัดด้านการวางแนว ความสามารถในการปรับขนาด และสัดส่วนการแสดงผลบนหน้าจอขนาดใหญ่ (sw>=600dp)
We introduced Platform API changes in Android 16 to ignore orientation, resizability, and aspect ratio restrictions on large screens (sw >= 600dp) for apps targeting API level 36 or higher. Developers have the option to opt out of these changes with SDK 36, but this opt-out will no longer be available for apps that target Android 17 (API level 37) or higher.
For more information, see Restrictions on orientation and resizability are ignored.
การเชื่อมต่อ
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงความสอดคล้องและสอดคล้องกับลักษณะการทำงานของ Java InputStream มาตรฐานสำหรับซ็อกเก็ต RFCOMM ของบลูทูธ
ลักษณะการทำงานของ read() ของ BluetoothSocket ที่สอดคล้องกันสำหรับ RFCOMM
สำหรับแอปที่กำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ตอนนี้เมธอด read() ของ InputStream ที่ได้จาก BluetoothSocket ที่อิงตาม RFCOMM จะแสดงผลเป็น -1 เมื่อซ็อกเก็ตปิดหรือการเชื่อมต่อหลุด
การเปลี่ยนแปลงนี้ทำให้ลักษณะการทำงานของซ็อกเก็ต RFCOMM สอดคล้องกับซ็อกเก็ต LE CoC และสอดคล้องกับเอกสารประกอบ InputStream.read() มาตรฐาน ซึ่งระบุว่าระบบจะแสดงผล -1 เมื่อถึงจุดสิ้นสุดของสตรีม
แอปที่อาศัยการตรวจจับ IOException เพียงอย่างเดียวเพื่อออกจากลูปการอ่านอาจได้รับผลกระทบจากการเปลี่ยนแปลงนี้ และควรอัปเดตลูปการอ่าน BluetoothSocket เพื่อตรวจสอบค่าที่แสดงผลเป็น -1 อย่างชัดเจน ซึ่งจะช่วยให้มั่นใจได้ว่าลูปจะสิ้นสุดอย่างถูกต้องเมื่ออุปกรณ์ระยะไกลยกเลิกการเชื่อมต่อหรือซ็อกเก็ตปิดลง ดูตัวอย่างการติดตั้งใช้งานที่แนะนำได้จากข้อมูลโค้ดในคู่มือโอนข้อมูลบลูทูธ