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

Commit 8369df09 authored by Eric Erfanian's avatar Eric Erfanian
Browse files

This change reflects the Dialer V10 RC00 branch.

RC00 is based on:
branch: dialer-android_release_branch/153304843.1
synced to: 153304843

following the instructions at go/dialer-aosp-release.

In this release:

* Removes final apache sources.
* Uses native lite compilation.

More drops will follow with subsequent release candidates
until we reach our final v10 release, in cadence with our
prebuilt drops.

Test: TreeHugger, on device
Change-Id: Ic9684057230f9b579c777820c746cd21bf45ec0f
parent afa29d4a
Loading
Loading
Loading
Loading
+42 −20
Original line number Diff line number Diff line
# Local modifications:
# * b/31757757 Precompiled proto classes have been included.
# * removed com.google.android.backup.api_key. This should be added to
#      the manifest in the top level directory.
# * removed com.google.android.geo.API_KEY key. This should be added to
#      the manifest files in java/com/android/incallui/calllocation/impl/
#      and /java/com/android/incallui/maps/impl/
# * b/35391680 apache temporarily included in the top level directory.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

@@ -20,7 +18,6 @@ BASE_DIR := java/com/android

# Primary dialer module sources.
SRC_DIRS := \
	apache \
	$(BASE_DIR)/contacts/common \
	$(BASE_DIR)/dialer \
	$(BASE_DIR)/incallui \
@@ -57,8 +54,10 @@ RES_DIRS := \
	$(BASE_DIR)/dialer/callcomposer/cameraui/res \
	$(BASE_DIR)/dialer/callcomposer/res \
	$(BASE_DIR)/dialer/calldetails/res \
	$(BASE_DIR)/dialer/calllog/ui/res \
	$(BASE_DIR)/dialer/calllogutils/res \
	$(BASE_DIR)/dialer/common/res \
	$(BASE_DIR)/dialer/contactsfragment/res \
	$(BASE_DIR)/dialer/dialpadview/res \
	$(BASE_DIR)/dialer/interactions/res \
	$(BASE_DIR)/dialer/notification/res \
@@ -87,7 +86,7 @@ RES_DIRS := \
	$(BASE_DIR)/incallui/video/impl/res \
	$(BASE_DIR)/incallui/video/protocol/res \
	$(BASE_DIR)/incallui/wifi/res \
	$(BASE_DIR)/voicemail/impl/res
	$(BASE_DIR)/voicemail/impl/res \


# Dialer manifest files to merge.
@@ -104,8 +103,10 @@ DIALER_MANIFEST_FILES += \
	$(BASE_DIR)/dialer/callcomposer/camera/camerafocus/AndroidManifest.xml \
	$(BASE_DIR)/dialer/callcomposer/cameraui/AndroidManifest.xml \
	$(BASE_DIR)/dialer/calldetails/AndroidManifest.xml \
	$(BASE_DIR)/dialer/calllog/ui/AndroidManifest.xml \
	$(BASE_DIR)/dialer/calllogutils/AndroidManifest.xml \
	$(BASE_DIR)/dialer/common/AndroidManifest.xml \
	$(BASE_DIR)/dialer/contactsfragment/AndroidManifest.xml \
	$(BASE_DIR)/dialer/dialpadview/AndroidManifest.xml \
	$(BASE_DIR)/dialer/interactions/AndroidManifest.xml \
	$(BASE_DIR)/dialer/notification/AndroidManifest.xml \
@@ -134,7 +135,7 @@ DIALER_MANIFEST_FILES += \
	$(BASE_DIR)/incallui/video/impl/AndroidManifest.xml \
	$(BASE_DIR)/incallui/video/protocol/AndroidManifest.xml \
	$(BASE_DIR)/incallui/wifi/AndroidManifest.xml \
	$(BASE_DIR)/voicemail/impl/AndroidManifest.xml
	$(BASE_DIR)/voicemail/impl/AndroidManifest.xml \


# Merge all manifest files.
@@ -142,12 +143,9 @@ LOCAL_FULL_LIBS_MANIFEST_FILES := \
	$(addprefix $(LOCAL_PATH)/, $(DIALER_MANIFEST_FILES))
LOCAL_SRC_FILES := $(call all-java-files-under, $(SRC_DIRS))
LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_FILES),$(LOCAL_SRC_FILES))
# Native protobuf compilation disabled b/36564333
# Include protocol buffers and use the nano compiler.
# LOCAL_SRC_FILES += $(call all-proto-files-under, $(SRC_DIRS))
# LOCAL_PROTOC_OPTIMIZE_TYPE := nano
# LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)
# LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java,generate_clear=true,store_unknown_fields=true,generate_equals=true
LOCAL_SRC_FILES += $(call all-proto-files-under, $(SRC_DIRS))
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)

LOCAL_RESOURCE_DIR := \
	$(addprefix $(LOCAL_PATH)/, $(RES_DIRS)) \
	$(support_library_root_dir)/design/res \
@@ -156,8 +154,6 @@ LOCAL_RESOURCE_DIR := \
	$(support_library_root_dir)/v7/cardview/res \
	$(support_library_root_dir)/v7/recyclerview/res

LOCAL_USE_AAPT2 := true

# We specify each package explicitly to glob resource files.
LOCAL_AAPT_FLAGS := \
	--auto-add-overlay \
@@ -171,8 +167,10 @@ LOCAL_AAPT_FLAGS := \
	--extra-packages com.android.dialer.callcomposer.camera.camerafocus \
	--extra-packages com.android.dialer.callcomposer.cameraui \
	--extra-packages com.android.dialer.calldetails \
	--extra-packages com.android.dialer.calllog.ui \
	--extra-packages com.android.dialer.calllogutils \
	--extra-packages com.android.dialer.common \
	--extra-packages com.android.dialer.contactsfragment \
	--extra-packages com.android.dialer.dialpadview \
	--extra-packages com.android.dialer.interactions \
	--extra-packages com.android.dialer.notification \
@@ -223,9 +221,10 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
	dialer-javax-annotation-api-target \
	dialer-javax-inject-target \
	dialer-libshortcutbadger-target \
	dialer-mime4j-core-target \
	dialer-mime4j-dom-target \
	jsr305 \
	libphonenumber \
	libprotobuf-java-nano \
	volley \

LOCAL_STATIC_ANDROID_LIBRARIES := \
@@ -278,6 +277,11 @@ LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := Dialer
LOCAL_CERTIFICATE := shared
LOCAL_PRIVILEGED_MODULE := true
LOCAL_USE_AAPT2 := true

# b/37483961 - Jack Not Compiling Dagger Class Properly
LOCAL_JACK_ENABLED := javac_frontend

include $(BUILD_PACKAGE)

# Cleanup local state
@@ -293,10 +297,10 @@ PROCESSOR_JARS :=
include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
    dialer-dagger2-compiler:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-compiler/2.6/dagger-compiler-2.6$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-dagger2-compiler:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-compiler/2.7/dagger-compiler-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-auto-value:../../../prebuilts/tools/common/m2/repository/com/google/auto/value/auto-value/1.3/auto-value-1.3$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-dagger2:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.6/dagger-2.6$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-dagger2-producers:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-producers/2.6/dagger-producers-2.6$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-dagger2:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.7/dagger-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-dagger2-producers:../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger-producers/2.7/dagger-producers-2.7$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-guava:../../../prebuilts/tools/common/m2/repository/com/google/guava/guava/20.0/guava-20.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-javax-annotation-api:../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2$(COMMON_JAVA_PACKAGE_SUFFIX) \
    dialer-javax-inject:../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1$(COMMON_JAVA_PACKAGE_SUFFIX)
@@ -320,7 +324,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-dagger2-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.6/dagger-2.6$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/google/dagger/dagger/2.7/dagger-2.7$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)
@@ -387,8 +391,6 @@ include $(BUILD_PREBUILT)

include $(CLEAR_VARS)

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-commons-io-target
LOCAL_SDK_VERSION := current
@@ -398,3 +400,23 @@ LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-mime4j-core-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/org/apache/james/apache-mime4j-core/0.7.2/apache-mime4j-core-0.7.2$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-mime4j-dom-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/org/apache/james/apache-mime4j-dom/0.7.2/apache-mime4j-dom-0.7.2$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
 No newline at end of file
+0 −392
Original line number Diff line number Diff line
/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you 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 org.apache.james.mime4j;

import java.util.HashMap;
import java.util.Map;

/**
 * Encapsulates the values of the MIME-specific header fields
 * (which starts with <code>Content-</code>).
 *
 *
 * @version $Id: BodyDescriptor.java,v 1.4 2005/02/11 10:08:37 ntherning Exp $
 */
public class BodyDescriptor {
    private static Log log = LogFactory.getLog(BodyDescriptor.class);

    private String mimeType = "text/plain";
    private String boundary = null;
    private String charset = "us-ascii";
    private String transferEncoding = "7bit";
    private Map<String, String> parameters = new HashMap<String, String>();
    private boolean contentTypeSet = false;
    private boolean contentTransferEncSet = false;

    /**
     * Creates a new root <code>BodyDescriptor</code> instance.
     */
    public BodyDescriptor() {
        this(null);
    }

    /**
     * Creates a new <code>BodyDescriptor</code> instance.
     *
     * @param parent the descriptor of the parent or <code>null</code> if this
     *        is the root descriptor.
     */
    public BodyDescriptor(BodyDescriptor parent) {
        if (parent != null && parent.isMimeType("multipart/digest")) {
            mimeType = "message/rfc822";
        } else {
            mimeType = "text/plain";
        }
    }

    /**
     * Should be called for each <code>Content-</code> header field of
     * a MIME message or part.
     *
     * @param name the field name.
     * @param value the field value.
     */
    public void addField(String name, String value) {

        name = name.trim().toLowerCase();

        if (name.equals("content-transfer-encoding") && !contentTransferEncSet) {
            contentTransferEncSet = true;

            value = value.trim().toLowerCase();
            if (value.length() > 0) {
                transferEncoding = value;
            }

        } else if (name.equals("content-type") && !contentTypeSet) {
            contentTypeSet = true;

            value = value.trim();

            /*
             * Unfold Content-Type value
             */
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < value.length(); i++) {
                char c = value.charAt(i);
                if (c == '\r' || c == '\n') {
                    continue;
                }
                sb.append(c);
            }

            Map<String, String> params = getHeaderParams(sb.toString());

            String main = params.get("");
            if (main != null) {
                main = main.toLowerCase().trim();
                int index = main.indexOf('/');
                boolean valid = false;
                if (index != -1) {
                    String type = main.substring(0, index).trim();
                    String subtype = main.substring(index + 1).trim();
                    if (type.length() > 0 && subtype.length() > 0) {
                        main = type + "/" + subtype;
                        valid = true;
                    }
                }

                if (!valid) {
                    main = null;
                }
            }
            String b = params.get("boundary");

            if (main != null
                    && ((main.startsWith("multipart/") && b != null)
                            || !main.startsWith("multipart/"))) {

                mimeType = main;
            }

            if (isMultipart()) {
                boundary = b;
            }

            String c = params.get("charset");
            if (c != null) {
                c = c.trim();
                if (c.length() > 0) {
                    charset = c.toLowerCase();
                }
            }

            /*
             * Add all other parameters to parameters.
             */
            parameters.putAll(params);
            parameters.remove("");
            parameters.remove("boundary");
            parameters.remove("charset");
        }
    }

    private Map<String, String> getHeaderParams(String headerValue) {
        Map<String, String> result = new HashMap<String, String>();

        // split main value and parameters
        String main;
        String rest;
        if (headerValue.indexOf(";") == -1) {
            main = headerValue;
            rest = null;
        } else {
            main = headerValue.substring(0, headerValue.indexOf(";"));
            rest = headerValue.substring(main.length() + 1);
        }

        result.put("", main);
        if (rest != null) {
            char[] chars = rest.toCharArray();
            StringBuffer paramName = new StringBuffer();
            StringBuffer paramValue = new StringBuffer();

            final byte READY_FOR_NAME = 0;
            final byte IN_NAME = 1;
            final byte READY_FOR_VALUE = 2;
            final byte IN_VALUE = 3;
            final byte IN_QUOTED_VALUE = 4;
            final byte VALUE_DONE = 5;
            final byte ERROR = 99;

            byte state = READY_FOR_NAME;
            boolean escaped = false;
            for (int i = 0; i < chars.length; i++) {
                char c = chars[i];

                switch (state) {
                    case ERROR:
                        if (c == ';')
                            state = READY_FOR_NAME;
                        break;

                    case READY_FOR_NAME:
                        if (c == '=') {
                            log.error("Expected header param name, got '='");
                            state = ERROR;
                            break;
                        }

                        paramName = new StringBuffer();
                        paramValue = new StringBuffer();

                        state = IN_NAME;
                        // $FALL-THROUGH$

                    case IN_NAME:
                        if (c == '=') {
                            if (paramName.length() == 0)
                                state = ERROR;
                            else
                                state = READY_FOR_VALUE;
                            break;
                        }

                        // not '='... just add to name
                        paramName.append(c);
                        break;

                    case READY_FOR_VALUE:
                        boolean fallThrough = false;
                        switch (c) {
                            case ' ':
                            case '\t':
                                break;  // ignore spaces, especially before '"'

                            case '"':
                                state = IN_QUOTED_VALUE;
                                break;

                            default:
                                state = IN_VALUE;
                                fallThrough = true;
                                break;
                        }
                        if (!fallThrough)
                            break;

                        // $FALL-THROUGH$

                    case IN_VALUE:
                        fallThrough = false;
                        switch (c) {
                            case ';':
                            case ' ':
                            case '\t':
                                result.put(
                                   paramName.toString().trim().toLowerCase(),
                                   paramValue.toString().trim());
                                state = VALUE_DONE;
                                fallThrough = true;
                                break;
                            default:
                                paramValue.append(c);
                                break;
                        }
                        if (!fallThrough)
                            break;

                        // $FALL-THROUGH$

                    case VALUE_DONE:
                        switch (c) {
                            case ';':
                                state = READY_FOR_NAME;
                                break;

                            case ' ':
                            case '\t':
                                break;

                            default:
                                state = ERROR;
                                break;
                        }
                        break;

                    case IN_QUOTED_VALUE:
                        switch (c) {
                            case '"':
                                if (!escaped) {
                                    // don't trim quoted strings; the spaces could be intentional.
                                    result.put(
                                            paramName.toString().trim().toLowerCase(),
                                            paramValue.toString());
                                    state = VALUE_DONE;
                                } else {
                                    escaped = false;
                                    paramValue.append(c);
                                }
                                break;

                            case '\\':
                                if (escaped) {
                                    paramValue.append('\\');
                                }
                                escaped = !escaped;
                                break;

                            default:
                                if (escaped) {
                                    paramValue.append('\\');
                                }
                                escaped = false;
                                paramValue.append(c);
                                break;
                        }
                        break;

                }
            }

            // done looping.  check if anything is left over.
            if (state == IN_VALUE) {
                result.put(
                        paramName.toString().trim().toLowerCase(),
                        paramValue.toString().trim());
            }
        }

        return result;
    }


    public boolean isMimeType(String mimeType) {
        return this.mimeType.equals(mimeType.toLowerCase());
    }

    /**
     * Return true if the BodyDescriptor belongs to a message
     */
    public boolean isMessage() {
        return mimeType.equals("message/rfc822");
    }

    /**
     * Return true if the BodyDescripotro belongs to a multipart
     */
    public boolean isMultipart() {
        return mimeType.startsWith("multipart/");
    }

    /**
     * Return the MimeType
     */
    public String getMimeType() {
        return mimeType;
    }

    /**
     * Return the boundary
     */
    public String getBoundary() {
        return boundary;
    }

    /**
     * Return the charset
     */
    public String getCharset() {
        return charset;
    }

    /**
     * Return all parameters for the BodyDescriptor
     */
    public Map<String, String> getParameters() {
        return parameters;
    }

    /**
     * Return the TransferEncoding
     */
    public String getTransferEncoding() {
        return transferEncoding;
    }

    /**
     * Return true if it's base64 encoded
     */
    public boolean isBase64Encoded() {
        return "base64".equals(transferEncoding);
    }

    /**
     * Return true if it's quoted-printable
     */
    public boolean isQuotedPrintableEncoded() {
        return "quoted-printable".equals(transferEncoding);
    }

    @Override
    public String toString() {
        return mimeType;
    }
}
 No newline at end of file
+0 −129
Original line number Diff line number Diff line
/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you 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 org.apache.james.mime4j;

import java.io.InputStream;
import java.io.IOException;

/**
 * InputStream that shields its underlying input stream from
 * being closed.
 *
 *
 * @version $Id: CloseShieldInputStream.java,v 1.2 2004/10/02 12:41:10 ntherning Exp $
 */
public class CloseShieldInputStream extends InputStream {

    /**
     * Underlying InputStream
     */
    private InputStream is;

    public CloseShieldInputStream(InputStream is) {
        this.is = is;
    }

    public InputStream getUnderlyingStream() {
        return is;
    }

    /**
     * @see java.io.InputStream#read()
     */
    public int read() throws IOException {
        checkIfClosed();
        return is.read();
    }

    /**
     * @see java.io.InputStream#available()
     */
    public int available() throws IOException {
        checkIfClosed();
        return is.available();
    }


    /**
     * Set the underlying InputStream to null
     */
    public void close() throws IOException {
        is = null;
    }

    /**
     * @see java.io.FilterInputStream#reset()
     */
    public synchronized void reset() throws IOException {
        checkIfClosed();
        is.reset();
    }

    /**
     * @see java.io.FilterInputStream#markSupported()
     */
    public boolean markSupported() {
        if (is == null)
            return false;
        return is.markSupported();
    }

    /**
     * @see java.io.FilterInputStream#mark(int)
     */
    public synchronized void mark(int readlimit) {
        if (is != null)
            is.mark(readlimit);
    }

    /**
     * @see java.io.FilterInputStream#skip(long)
     */
    public long skip(long n) throws IOException {
        checkIfClosed();
        return is.skip(n);
    }

    /**
     * @see java.io.FilterInputStream#read(byte[])
     */
    public int read(byte b[]) throws IOException {
        checkIfClosed();
        return is.read(b);
    }

    /**
     * @see java.io.FilterInputStream#read(byte[], int, int)
     */
    public int read(byte b[], int off, int len) throws IOException {
        checkIfClosed();
        return is.read(b, off, len);
    }

    /**
     * Check if the underlying InputStream is null. If so throw an Exception
     *
     * @throws IOException if the underlying InputStream is null
     */
    private void checkIfClosed() throws IOException {
        if (is == null)
            throw new IOException("Stream is closed");
    }
}
 No newline at end of file
+0 −177

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −139

File deleted.

Preview size limit exceeded, changes collapsed.

Loading