Search code examples
wear-oswatch-face-api

How to test low-bit ambient and burn-in protection when making watch faces?


The watch face API for Android Wear requires special considerations with certain screens, namely those that need low-bit ambient and burn-in protection (see the design guide).

I only have watches that do not use either of these modes by default. When developing a watch face, what is the best way to test these modes without having a specific watch?


Solution

  • You will receive information about burn in protection and low ambient through WatchFaceService.Engine.onPropertiesChanged callback. For example:

        @Override
        public void onPropertiesChanged(Bundle properties) {
            super.onPropertiesChanged(properties);
            mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
            boolean burnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false);
            mHourPaint.setTypeface(burnInProtection ? NORMAL_TYPEFACE : BOLD_TYPEFACE);
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
            }
        }
    

    If you want to test it, just directly set the values:

        mLowAmbient = true;
        boolean burnInProtection = true;
    

    and run your code to see, if it renders the watch face. In this case you should render watch face as if it was in low ambient and with burn in protection. Check all 4 combinations and you are good to go, you can go back to fetching the values from the bundle.