Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed50c006 authored by Martijn Coenen's avatar Martijn Coenen Committed by Android (Google) Code Review
Browse files

Merge "Add NfcBarcode technology API." into jb-mr1-dev

parents 7ae18833 0bec15eb
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -608,6 +608,36 @@ $(full_target): $(framework_built) $(gen)

droidcore: doc-comment-check-docs

# ====  static html in the pdk ==================================
include $(CLEAR_VARS)

LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
LOCAL_DROIDDOC_HTML_DIR:=../../vendor/pdk/data/google/docs
LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
LOCAL_ADDITIONAL_DEPENDENCIES:=$(framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES)

LOCAL_MODULE := offline-pdk

LOCAL_DROIDDOC_OPTIONS:=\
		-hdf android.whichdoc offline \
		-hdf android.whichmodule $(LOCAL_MODULE)

LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-pdk

include $(BUILD_DROIDDOC)

static_doc_index_redirect := $(out_dir)/index.html
$(static_doc_index_redirect): \
	$(LOCAL_PATH)/docs/docs-documentation-redirect.html | $(ACP)
	$(hide) mkdir -p $(dir $@)
	$(hide) $(ACP) $< $@

$(full_target): $(static_doc_index_redirect)
$(full_target): $(framework_built)

# ====  static html in the sdk ==================================
include $(CLEAR_VARS)

+42 −3
Original line number Diff line number Diff line
@@ -13948,6 +13948,14 @@ package android.nfc.tech {
    method public byte[] transceive(byte[]) throws java.io.IOException;
  }
  public final class NfcBarcode extends android.nfc.tech.BasicTagTechnology {
    method public static android.nfc.tech.NfcBarcode get(android.nfc.Tag);
    method public byte[] getBarcode();
    method public int getType();
    field public static final int TYPE_KOVIO = 1; // 0x1
    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
  }
  public final class NfcF extends android.nfc.tech.BasicTagTechnology {
    method public static android.nfc.tech.NfcF get(android.nfc.Tag);
    method public byte[] getManufacturer();
@@ -23432,6 +23440,17 @@ package android.util {
    method public void set(T, V);
  }
  public class PropertyValueModel extends android.util.ValueModel {
    method public T get();
    method public H getHost();
    method public android.util.Property<H, T> getProperty();
    method public java.lang.Class<T> getType();
    method public static android.util.PropertyValueModel<H, T> of(H, android.util.Property<H, T>);
    method public static android.util.PropertyValueModel<H, T> of(H, java.lang.Class<T>, java.lang.String);
    method public static android.util.PropertyValueModel of(java.lang.Object, java.lang.String);
    method public void set(T);
  }
  public class SparseArray implements java.lang.Cloneable {
    ctor public SparseArray();
    ctor public SparseArray(int);
@@ -23580,6 +23599,14 @@ package android.util {
    field public int type;
  }
  public abstract class ValueModel {
    ctor protected ValueModel();
    method public abstract T get();
    method public abstract java.lang.Class<T> getType();
    method public abstract void set(T);
    field public static final android.util.ValueModel EMPTY;
  }
  public class Xml {
    method public static android.util.AttributeSet asAttributeSet(org.xmlpull.v1.XmlPullParser);
    method public static android.util.Xml.Encoding findEncodingByName(java.lang.String) throws java.io.UnsupportedEncodingException;
@@ -25027,6 +25054,7 @@ package android.view {
    method public boolean isHorizontalScrollBarEnabled();
    method public boolean isHovered();
    method public boolean isInEditMode();
    method public boolean isInLayout();
    method public boolean isInTouchMode();
    method public boolean isLayoutRequested();
    method public boolean isLayoutRtl();
@@ -27966,10 +27994,12 @@ package android.widget {
    method public abstract void onSelectedDayChange(android.widget.CalendarView, int, int, int);
  }
  public class CheckBox extends android.widget.CompoundButton {
  public class CheckBox extends android.widget.CompoundButton implements android.widget.ValueEditor {
    ctor public CheckBox(android.content.Context);
    ctor public CheckBox(android.content.Context, android.util.AttributeSet);
    ctor public CheckBox(android.content.Context, android.util.AttributeSet, int);
    method public android.util.ValueModel<java.lang.Boolean> getValueModel();
    method public void setValueModel(android.util.ValueModel<java.lang.Boolean>);
  }
  public abstract interface Checkable {
@@ -28142,14 +28172,16 @@ package android.widget {
    method public void setSize(int, int);
  }
  public class EditText extends android.widget.TextView {
  public class EditText extends android.widget.TextView implements android.widget.ValueEditor {
    ctor public EditText(android.content.Context);
    ctor public EditText(android.content.Context, android.util.AttributeSet);
    ctor public EditText(android.content.Context, android.util.AttributeSet, int);
    method public void extendSelection(int);
    method public android.util.ValueModel<java.lang.CharSequence> getValueModel();
    method public void selectAll();
    method public void setSelection(int, int);
    method public void setSelection(int);
    method public void setValueModel(android.util.ValueModel<java.lang.CharSequence>);
  }
  public abstract interface ExpandableListAdapter {
@@ -29175,11 +29207,13 @@ package android.widget {
    method public abstract java.lang.Object[] getSections();
  }
  public class SeekBar extends android.widget.AbsSeekBar {
  public class SeekBar extends android.widget.AbsSeekBar implements android.widget.ValueEditor {
    ctor public SeekBar(android.content.Context);
    ctor public SeekBar(android.content.Context, android.util.AttributeSet);
    ctor public SeekBar(android.content.Context, android.util.AttributeSet, int);
    method public android.util.ValueModel<java.lang.Integer> getValueModel();
    method public void setOnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener);
    method public void setValueModel(android.util.ValueModel<java.lang.Integer>);
  }
  public static abstract interface SeekBar.OnSeekBarChangeListener {
@@ -29753,6 +29787,11 @@ package android.widget {
    method public android.widget.TextView getText2();
  }
  public abstract interface ValueEditor {
    method public abstract android.util.ValueModel<T> getValueModel();
    method public abstract void setValueModel(android.util.ValueModel<T>);
  }
  public class VideoView extends android.view.SurfaceView implements android.widget.MediaController.MediaPlayerControl {
    ctor public VideoView(android.content.Context);
    ctor public VideoView(android.content.Context, android.util.AttributeSet);
+1 −1
Original line number Diff line number Diff line
@@ -1824,7 +1824,7 @@ public class AccountManager {
     * Returns an intent to an {@link Activity} that prompts the user to choose from a list of
     * accounts.
     * The caller will then typically start the activity by calling
     * <code>startActivityWithResult(intent, ...);</code>.
     * <code>startActivityForResult(intent, ...);</code>.
     * <p>
     * On success the activity returns a Bundle with the account name and type specified using
     * keys {@link #KEY_ACCOUNT_NAME} and {@link #KEY_ACCOUNT_TYPE}.
+2 −2
Original line number Diff line number Diff line
@@ -140,8 +140,8 @@ public final class Ndef extends BasicTagTechnology {
     *
     * <p>Does not cause any RF activity and does not block.
     *
     * @param tag an MIFARE Classic compatible tag
     * @return MIFARE Classic object
     * @param tag an NDEF compatible tag
     * @return Ndef object
     */
    public static Ndef get(Tag tag) {
        if (!tag.hasTech(TagTechnology.NDEF)) return null;
+102 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.nfc.tech;

import android.nfc.Tag;
import android.os.Bundle;
import android.os.RemoteException;

/**
 * Provides access to tags containing just a barcode.
 *
 * <p>Acquire an {@link NfcBarcode} object using {@link #get}.
 *
 */
public final class NfcBarcode extends BasicTagTechnology {

    /** Kovio Tags */
    public static final int TYPE_KOVIO = 1;
    public static final int TYPE_UNKNOWN = -1;

    /** @hide */
    public static final String EXTRA_BARCODE_TYPE = "barcodetype";

    private int mType;

    /**
     * Get an instance of {@link NfcBarcode} for the given tag.
     *
     * <p>Returns null if {@link NfcBarcode} was not enumerated in {@link Tag#getTechList}.
     *
     * <p>Does not cause any RF activity and does not block.
     *
     * @param tag an NfcBarcode compatible tag
     * @return NfcBarcode object
     */
    public static NfcBarcode get(Tag tag) {
        if (!tag.hasTech(TagTechnology.NFC_BARCODE)) return null;
        try {
            return new NfcBarcode(tag);
        } catch (RemoteException e) {
            return null;
        }
    }

    /**
     * Internal constructor, to be used by NfcAdapter
     * @hide
     */
    public NfcBarcode(Tag tag) throws RemoteException {
        super(tag, TagTechnology.NFC_BARCODE);
        Bundle extras = tag.getTechExtras(TagTechnology.NFC_BARCODE);
        if (extras != null) {
            mType = extras.getInt(EXTRA_BARCODE_TYPE);
        } else {
            throw new NullPointerException("NfcBarcode tech extras are null.");
        }
    }

    /**
     * Returns the NFC Barcode tag type.
     *
     * <p>Currently only one of {@link #TYPE_KOVIO} or {@link TYPE_UNKNOWN}.
     *
     * <p>Does not cause any RF activity and does not block.
     *
     * @return the NFC Barcode tag type
     */
    public int getType() {
        return mType;
    }

    /**
     * Returns the barcode of an NfcBarcode tag.
     *
     * <p>Does not cause any RF activity and does not block.
     *
     * @return a byte array containing the barcode
     */
    public byte[] getBarcode() {
        switch (mType) {
            case TYPE_KOVIO:
                // For Kovio tags the barcode matches the ID
                return mTag.getId();
            default:
                return null;
        }
    }
}
Loading